Footers And Headers

Note : we have rolled out a completely revised API in February 2014. The documentation for that is ON THE MAIN SITE. New users since february 8th can only sign up for that, whilst current API users can choose to work with the old API or switch to the new one. The documentation for the ‘old’ API features is below.

How can I generate my own header and footer content, passing variables in the url?

Headers and footers can be added to the document by the –header-* and –footer* arguments respectfully. In header and footer text string supplied to e.g. –header-left, the following variables will be substituted.

* [page] Replaced by the number of the pages currently being printed
* [frompage] Replaced by the number of the first page to be printed
* [topage] Replaced by the number of the last page to be printed
* [webpage] Replaced by the URL of the page being printed
* [section] Replaced by the name of the current section
* [subsection] Replaced by the name of the current subsection
* [date] Replaced by the current date in system local format
* [time] Replaced by the current time in system local format

As an example specifying –header-right “Page [page] of [toPage]”, will result in the text “Page x of y” where x is the number of the current page and y is the number of the last page, to appear in the upper left corner in the document.

Headers and footers can also be supplied with HTML documents. As an example one could specify –header-html header.html, and use the following content in header.html:

Notice that the –header-html parameter has been url encoded (the / sign has become a %2F, etc.). This is complex, but is needed because the pdfmyurl server needs the complete url, and the & and ? characters will otherwise not be passed. You can read up on url encoding here.

One thought on “Footers And Headers”

Attention – the examples above are only valid for the old API to which you can NOT subscribe anymore. Please refer to the documentation of the new footer and header instructions at http://pdfmyurl.com/headers-and-footers