1
votes

sorry for another wkhtmltopdf font topic. I´m trying to convert a HTML page which uses a custom font by use of wkthmltopdf:

exec('/home/camelot/bin/wkhtmltopdf --orientation portrait --encoding utf-8 --page-size A4 --disable-smart-shrinking -T 0 -B 0 -L 0 -R 0 bill.html bill6.pdf ');

...

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

Unfortunately some characters are broken in resulting PDF: enter image description here

I´ve recognized when only using the svg version of my custom font the shapes are rendered correctly but also the type gets converted to an image.

Does one know if I can use an SVG font without converting it to an image OR how to accomplish correct font rendering?

  • wkhtmltopdf 0.12.4
  • centos 6.9
  • tried as base64 encoded type
  • tried to install the fonts in centos
  • tried older versions 0.9 and 0.10 ...
1

1 Answers

2
votes

This is how it solved it for me:

Use only OTF format no matter if the font gets installed in centos OR loaded by font-face. With otf the font is displayed correctly and stays type.