将wkhtmltopdf与google字体一起使用时,会添加额外的字母空间

时间:2014-11-04 01:21:34

标签: wkhtmltopdf google-font-api

对于symfony项目,我正在使用snappy bundle,它使用wkhtmltopdf将网页转换为pdf。我使用谷歌字体使用不同的字体。字体在网页上显示正常,但在转换为pdf后,任何使用字体的部分在字母之间的间距都很差。有没有办法修复字母的间距?

PDF图片:(使用谷歌字体,EB Garamond)

pdf example image

html代码:

<link href='http://fonts.googleapis.com/css?family=EB+Garamond' rel='stylesheet' type='text/css'>

Normal Text: qwertyuiopasdfghjklzxcvbnm<br>
<div style="font-family: 'EB Garamond', serif;">
google EB Garamond: qwertyuiopasdfghjklzxcvbnm<br>

google EB Garamond: workstation ergonomic evaluations.</div><br>
Normal Text: workstation ergonomic evaluations.

我也尝试过使用其他类似的其他字体,比如adobe typekit,但仍然遇到同样的问题。

2 个答案:

答案 0 :(得分:0)

尝试添加&#39; - dpi 96&#39;切换到wkhtmltopdf命令行。

我遇到一个问题,即字母连接在一起并使用--dpi 96与字母间距组合:0.09em;解决了它

答案 1 :(得分:0)

我们遇到了同样的问题。由于将DPI设置为仅96(打印通常至少使用300)会导致图像模糊,因此我们尝试使用SVG字体文件来达到目的。