Get wkhtmltopdf for custom font folder recognition

I think my problem is defined here ... I installed some custom fonts in the ~ / .fonts directory and run "mkfontdir" and "mkfontscale". Fonts are displayed when I list them using "fc-list". The problem remains that wkhtmltopdf does not recognize them. Other system fonts, such as Courier 10 Pitch, are recognized ... just not what is in my user directory. So is there a way to get wkhtmltopdf (or, for that matter, webkit) to recognize the fonts in my folder? Is there something I have to do for ssh, or is there an option that I can set in ruby?

+6
source share
1 answer

Is there a problem? I just tried with the Ubuntu virtual server and worked with fonts without problems, although the version obtained from the repositories is 0.9.9, which is quite old. My process:

  • Installed xserver, fluxbox, mupdf (viewer), chromium and wkhtmltopdf
  • Got a terrific font (PonyRides)
  • Ran mkfontdir, mkfontscale and fc-list (the font appeared on the list)
  • Made test.html with one paragraph that used a custom font
  • wkhtmltopd test.html test.pdf

I checked the PDF locally and then on another computer, and the custom font even worked there, although I didn't have the font installed. http://temp-share.com/show/dPf3m39HW <- created by PDF (I hope that the link is not too temporary).

0
source

Source: https://habr.com/ru/post/893988/


All Articles