wkhtmltopdf缩小了输入,这在旧版本中是可以的。

huangapple go评论126阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年3月9日 18:11:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/75683149.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定