I'm generating a PDF from a template using the Printmaker plugin. My CSS is being picked up and rendered mostly correctly and if the template is rendered to screen as HTML then the fonts work. However I can't get the fonts to work with the PDF generation.

Does anyone know what I need to do to get the font information embedded within the PDF?

  • Make sure your fonts are TTF.
  • If you're loading them by remote URL, make sure the isRemoteEnabled is set to true.
  • If you're changing weights, make sure to use the named weights in your CSS (normal, bold) rather than numeric weights.

(These are limitations of the underlying DOMPDF library, which is used in Printmaker 1.x. The next release of Printmaker, for Craft 3, uses a much nicer rendering engine, which will eliminate these limitations.)

  • My particular issue was down to the paths but the weights and isRemoteEnabled are top tips so I'll mark this as the answer.
    – foamcow
    Feb 23 '18 at 18:24

Seemed to be a matter of requiring the full URL to the font file and removal of any weight declarations in the CSS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.