2
votes

For a symfony project, i am using the snappy bundle, that used wkhtmltopdf to convert the webpage into a pdf. I am using google fonts to use different font faces. The font shows up fine on the web page, but after converting to a pdf, any sections that use font faces have bad spacing between letters. Is there any way to fix the spacing on the letters?

Image of PDF: (using google font, EB Garamond)

pdf example image

html code:

<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.

I have also tried using other fonts from other soruces, like adobe typekit and still have the same problem.

2
Same issue here - ever found a solution ?Mat

2 Answers

0
votes

Try adding the '--dpi 96' switch to the wkhtmltopdf command line.

I had an issue with letters getting joined together and using --dpi 96 in combination with letter-spacing:0.09em; solved it

0
votes

We faced the same problem. As setting the DPI to only 96 (print usually uses at least 300) resulted in blurry images, we tried to use SVG font files, which did the trick.