11

我在以下设备上使用 wkhtmltopdf 0.10.0 rc2:Linux 3.2.0-24-generic #38-Ubuntu x86_64 GNU/Linux

我无法创建带有margin-top或的 PDF margin-bottom(没有错误)

我正在使用以下命令:

wkhtmotopdf -T 50 -B 50 http://google.com ./test.pdf
wkhtmotopdf --margin-top 50 --margin-bottom 50 page.html ./test.pdf

当我尝试这个时:

wkhtmotopdf -L 50 -R 50 -T 50 -B 50 page.html ./test.pdf

左边距和右边距完美(仍然没有边距顶部或边距底部)。我转换哪个 URL 或页面并不重要。

编辑:

看起来这是一个错误。对于仍然想要一些margin-top/margin-bottom的人。尝试使用 header-html/footer-html 功能:

刚刚意识到剪裁问题是通过添加 header-spacing 和 footer-spacing 参数来解决的:

wkhtmotopdf -L 50 -R 50 -T 50 -B 50 http://google.com --header-html blank.html --header-spacing 5 --footer-html blank.html --footer-spacing 5 ./test.pdf

4

0 回答 0