How can I use footers and headers with wkhtmltopdf?

前端 未结 1 1601
说谎
说谎 2021-01-31 14:10

I encountered a situation where I had to use footers and headers in my generated PDF printounts. CSS solution works for the first page only. And the only information I found is

相关标签:
1条回答
  • 2021-01-31 14:44

    Wkhtmltopdf does support even very complex headers and footers.

    wkhtmltopdf.exe -T 50mm --header-html www.google.com www.stackoverflow.com test.pdf && test.pdf
    

    That command uses the page at www.google.com as a 50mm header for www.stackoverflow.com for every page.

    Note: If you use a custom page for the header/footer, you need to add <!DOCTYPE HTML> in the beginning of your header/footer HTML!

    0 讨论(0)
提交回复
热议问题