<p>Finally I loaded the fonts with the load_font.php script (dompdf/utils) and that's how it works.</p>
<p>(See also: <a href="https://stackoverflow.com/a/18066618/10228942">https://stackoverflow.com/a/18066618/10228942</a>)</p>

CC BY-SA 4.0
2023-01-13T12:54:19.707Z
Are you able to expand on this answer at all? I downloaded load_font.php here: https://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
CC BY-SA 4.0
2023-01-17T16:44:05.463Z
@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
CC BY-SA 4.0
2023-01-18T17:26:20.830Z
thank you for this - I got it working now (the path to autoload.php was incorrect as you suggest).
Tchick
CC BY-SA 4.0
2023-01-19T18:32:48.643Z
You're welcome!
Sanbo
CC BY-SA 4.0
2022-09-01T11:29:53.387Z
2022-09-01T12:40:49.963Z
2022-09-01T12:40:49.963Z
Sanbo
<p>I want to render two custom fonts in my commerce pdf, but it does not work.</p>
<p>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.</p>
<p>Any idea? Many thanks in advance!</p>

<plugin-craftcommerce><dompdf>
Custom fonts in pdf
# Custom fonts in pdf

(Asked by: username_0 on 2022-08-31)

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!

**Tags:** plugin-craftcommerce, dompdf

---

## 1 answers

### Answer by username_0 on 2022-09-01. Score: 0 | Accepted answer

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>)

> **Comments:**
> **username_1**: Are you able to expand on this answer at all? I downloaded load_font.php here: https://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";  
> **username_0**: @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"  
> **username_1**: thank you for this - I got it working now (the path to autoload.php was incorrect as you suggest).  
> **username_0**: You're welcome!  

---

