I want to render two custom fonts in my commerce pdf, but it does not work.

I tried it in several ways: I use the @font-face and used the path as well the URL and also put the font files in different locations: in /web/assets/fonts, in /storage/fonts and directly in the dompdf/lib/fonts ... nothing works! And I used several fonts.

Any idea? Many thanks in advance!

1 Answer 1


Finally I loaded the fonts with the load_font.php script (dompdf/utils) and that's how it works.

(See also: https://stackoverflow.com/a/18066618/10228942)

  • Are you able to expand on this answer at all? I downloaded load_font.php here: github.com/dompdf/utils/blob/master/load_font.php but am having trouble running it successfully. Not sure how to configure the following within load_font: // 1. [Required] Point to the composer or dompdf autoloader require_once "vendor/autoload.php";
    – Tchick
    Jan 13 at 12:54
  • @Tchick Have you read the linked answer? When you saved the load_font.php in the dompdf folder, you have to change the path to "../autoload.php"
    – Sanbo
    Jan 17 at 16:44
  • thank you for this - I got it working now (the path to autoload.php was incorrect as you suggest).
    – Tchick
    Jan 18 at 17:26
  • You're welcome!
    – Sanbo
    Jan 19 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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