Closed srocerer closed 2 years ago
@srocevas for custom font please refer to DomPDF https://github.com/dompdf/dompdf/issues?q=is%3Aissue+custom+font package, because it responsible for PDF rendering. Laravel Invoices wraps all invoice functionality around it.
I also have the same issue before. And I would also say this wasn't the issue of this library. However, since Laravel Invoices relies on laravel-dompdf, which wraps the DomPDF library. It seems calling the setOptions
method in laravel-dompdf will override the whole settings to DomPDF's default instead of laravel-dompdf's default...
Therefore, even the font directory of laravel-dompdf is set to /storage/fonts
. It will reverted to DomPdf's default (i.e. in /vendor/dompdf/dompdf/fonts
) once the setOptions
has been called (Laravel Invoices use this method to render page number). This results DomPDF unable to find your custom font.
I have already created a pull request on laravel-dompdf (see: https://github.com/barryvdh/laravel-dompdf/pull/846) to fix this and waiting for their approval.
How to add custom font to the invoice I have tried different ways, different font types but none of them worked. In HTML view everything looks good but after changing the method to download invoice text looks missing.
Example font import: