
As anĮxample one could specify -header-html header.html, and use the Headers and footers can also be supplied with HTML documents. Number of the current page and y is the number of the last page, toĪppear in the upper left corner in the document.
Replaced by the number of pages in the current site being convertedĪs an example specifying -header-right "Page of ", will result in the text "Page x of y" where x is the. Replaced by the number of the page in the current site being converted. Replaced by the title of the output document. Replaced by the title of the of the current page object. Replaced by the current time in system local format.
PDFKIT GEM 0.5 PRINTING BLANK PAGE ISO
Replaced by the current date in ISO 8601 extended format. Replaced by the current date in system local format. Replaced by the name of the current subsection. Replaced by the name of the current section. Replaced by the URL of the page being printed. Replaced by the number of the last page to be printed. Replaced by the number of the first page to be printed. Replaced by the number of the pages currently being printed. Header and footer text string supplied to e.g. ĭocument by the -header-* and -footer* arguments respectively. Last note: if using thymeleaf, replace with. The only difference with other's solution is the use of // tags. Safe approach, even if you are using XHTML (for example, with thymeleaf). We then get each supported variable from the query string and replace the content in all elements with a matching class name. SubstitutePdfVariables() is called in body onload. Var elements = document.getElementsB圜lassName(name) Return match & decodeURIComponent(match.replace(/\+/g, ' '))
Here is a complete working example of a footer HTML:
So the solution is to retrieve these parameters using a bit of JS and rendering them into the HTML template. the arguments are sent to the header/footer html documents in GET fashion. Among a few other parameters, the page number and total page number are passed to the footer HTML as query params, as outlined in the official docs: