WKHTMLTOPDF - 是否可以显示动态标题? [英] WKHTMLTOPDF -- Is possible to display dynamic headers?

查看:190
本文介绍了WKHTMLTOPDF - 是否可以显示动态标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用wkhtmltopdf --header-html选项,但似乎它真的只适用于html代码。有什么办法可以添加一些PHP,强制它以某种方式工作吗?我需要在每个页面上显示日期和用户的电子邮件...感谢任何建议;)

Im using wkhtmltopdf --header-html option, but it seems, that it really works only with html code. Is there any way I can add some PHP and force it to working somehow? I need to display Date and user´s e-mail on every page... Thanks for any advice ;)

推荐答案

你可以喂--header-html几乎任何东西:)尝试以下来看我的观点:

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

所以isitchristmas.com可以www.yoursite.com/magical/ponies.php

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

只是为了添加,你不能在本地运行php文件,所以你需要一个网络服务器来服务他们。如果您需要100%的本地动态标题,您可以使用javascript尝试一些假动态;使用 - header-html myheader.html?date = 12345& usermail = derp 然后使用javacript处理URL(我没有尝试过)。

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).

这篇关于WKHTMLTOPDF - 是否可以显示动态标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆