Whtmltopdf does not display TrueType fonts

We are using wkhtmltopdf to render PDF from HTML page, however fonts like Verdana and Georgia are not rendering correctly. We have installed TrueType fonts on our server using these instructions. Fonts are set inline using style tags: style = "font-family: verdana, geneva;"

Any suggestions on what we can try to get these fonts would be appreciated.

+3


source to share


3 answers


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



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

+3


source


Have you configured the fonts correctly in your CSS?

eg.



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

      

0


source


I'm not sure if this works for this problem, but I solved my problems by installing real 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

      

0


source







All Articles