Wkhtmltopdf不显示TrueType字体

时间:2013-01-22 20:55:17

标签: php fonts wkhtmltopdf

我们使用wkhtmltopdf从HTML页面呈现PDF,但Verdana和Georgia等字体无法正常显示。我们使用these指令在我们的服务器上安装了TrueType字体。使用样式标记内联设置字体:style =“font-family:verdana,geneva;”

有关我们可以尝试接下来要显示这些字体的任何建议,我们将不胜感激。

3 个答案:

答案 0 :(得分:3)

尝试在此问题上发布Arman H.的解决方案:Google Web Fonts and PDF generation from HTML with wkhtmltopdf

Base64将字体编码到你的css中对我们来说就像是一种魅力。

答案 1 :(得分:0)

您是否正确设置了css中的字体?

e.g。

@font-face {
 font-family: 'Verdana';
 src: url('verdana-webfont.eot');
 src: url('verdana-webfont.eot?#iefix') format('embedded-opentype'),
 url('verdana-webfont.woff') format('woff'),
 url('verdana-webfont.ttf') format('truetype'),
 url('verdana-webfont.svg#Verdana') format('svg');
 font-weight: normal;
 font-style: normal;
 }

答案 2 :(得分:0)

我不确定这是否可以解决此问题,但我通过安装真型字体解决了我的问题。之后,wkhtmltopdf能够显示这些字体。

Ubuntu(18.04)

apt install fonts-droid-fallback ttf-dejavu fonts-freefont-ttf fonts-liberation ttf-ubuntu-font-family

高山Linux(3.9)

apk add ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family
相关问题