Wkhtmltopdf not displaying TrueType fonts

喜夏-厌秋 提交于 2019-12-06 01:46:45
Yardboy

Try Arman H.'s solution posted over on this question: Google Web Fonts and PDF generation from HTML with wkhtmltopdf

Base64 encoding the fonts into your css has worked like a charm for us.

have you set up the fonts in your css correctly?

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;
 }

I am not sure if this works for this problem but I solved my problems by installing true type fonts. After that wkhtmltopdf was able to display these fonts.

Ubuntu (18.04)

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

Alpine Linux (3.9)

apk add ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!