Search code examples
wkhtmltopdf

why wkhtmltopdf header and footer are applied only on the table of contents page (toc)?


I want to apply the header and the footer to all pages but what I got is that they only appear on the toc (table of content) page. How to solve this problem?

I'm using this command.

wkhtmltopdf --encoding 'UTF-8' toc --xsl-style-sheet /Users/Documents/toc.xsl --header-html /Users/Documents/header.html --header-spacing 10 --footer-html /Users/Documents/footer.html --footer-spacing 10 /Users/Documents/draft-11.html /Users/Documents/content-draft.pdf

Solution

  • This fix is to provide the header and the footer twice once for TOC and once for the contents themselves

    wkhtmltopdf --encoding 'UTF-8' toc --xsl-style-sheet /Users/Documents/toc.xsl --header-html /Users/Documents/header.html --header-spacing 10 --footer-html /Users/Documents/footer.html --footer-spacing 10 /Users/Documents/draft-11.html  --header-html /Users/Documents/header.html --header-spacing 10 --footer-html /Users/Documents/footer.html --footer-spacing 10 /Users/Documents/content-draft.pdf