0

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

0

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)

4
  • 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
    Commented Jan 13, 2023 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
    Commented Jan 17, 2023 at 16:44
  • thank you for this - I got it working now (the path to autoload.php was incorrect as you suggest).
    – Tchick
    Commented Jan 18, 2023 at 17:26
  • You're welcome!
    – Sanbo
    Commented Jan 19, 2023 at 18:32

Your Answer

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

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