英文:
wkhtmltopdf shrinks the input, which was fine in the older version
问题
We use wkhtmltopdf to generate PDF from html and when upgraded from 0.12.3 to 0.12.6, we noticed that the PDFs generated were in different resolutions. Unfortunately, the viewport-size, or dpi did not help in fixing the problem.
Tried to downgrade to older version, but that's a crude way to go deprecated soon. So, dpi / viewport-size seems to have also failed us. Finally, found zoom and adjusted the level to 1.25-1.3 times. I know this is never going to help across the different kinds of PDFs that are generated.
Any help here will be much appreciated. Thanks!
英文:
We use wkhtmltopdf to generate PDF from html and when upgraded from 0.12.3 to 0.12.6, we noticed that the PDFs generated were in different resolutions.
Unfortunately, the viewport-size, or dpi did not help in fixing the problem.
Tried to downgrade to older version, but that's a crude way to go deprecated soon. So, dpi / viewport-size seems to have also failed us.
Finally, found zoom and adjusted the level to 1.25-1.3 times. I know this is never going to help across the different kinds of PDFs that are generated.
Any help here will be much appreciated. Thanks!
答案1
得分: 0
在0.12.4版本之后,wkhtmltopdf会根据dpi和Web驱动程序自动计算PDF的分辨率。要返回到传统的PDF导出方式,需要使用--disable-smart-shrinking。
参考链接:https://github.com/wkhtmltopdf/wkhtmltopdf/issues/5056
英文:
Turns out, after 0.12.4 version, wkhtmltopdf auto computes resolution for the pdf based on the dpi and web-driver.
To get back to the legacy pdf export, we need to use --disable-smart-shrinking.
ref: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/5056
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论