WKHTMLTOPDF — Is possible to display dynamic headers?

倖福魔咒の 提交于 2019-12-02 04:24:10

You can feed --header-html almost anything :) Try the following to see my point:

wkhtmltopdf.exe --margin-top 30mm --header-html isitchristmas.com google.fi x.pdf

So isitchristmas.com could be www.yoursite.com/magical/ponies.php

Just to add, you cant run the php files locally so you need a webserver to serve them. If you need 100% local dynamic headers you could try some fake dynamic with javascript; use --header-html myheader.html?date=12345&usermail=derp and then process the URL with javacript (I havent tried it).

To add extra query string parameters for your header/footer html you need to use the command line switch 'replace'.

The wording of the help/manual is a little misleading (i.e. better wording would have cleared up the issue), as it lead me on the wrong path (tried using the 'post' switch). I found the solution after digging through the code on github.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!