When using dompdf library for generating html to pdf i don't find any problem. But when i adding the @font-face in the CSS and providing the .ttf file for "Courier New" Font, the dompdf was stuck at some process and it won't finish generating the pdf file.
i'm adding this line to my style
@font-face {
font-family: 'CourierNew';
src: url('{{ asset('fonts/cour.ttf') }}');
}
and i'm putting the Courier New TrueType file at the public/fonts/ folder
My Project using :
- Laravel : 5.8
- PHP : 7.3.11
- barryvdh/laravel-dompdf : ^0.8.4
Did anyone encounter such a problem or have a solution regarding this problem?
Thank you in advance.
src: {{ public_path('fonts/cour.ttf') }} ;
– porloscerros Ψ{{ asset('fonts/cour.ttf') }}
and{{ public_path('fonts/cour.ttf') }}
are already strings. I used this aproach and work fine for me. And maybe you have to set a caching folder to dompdf as Helioarch mentioned github.com/barryvdh/laravel-dompdf/issues/…. – porloscerros Ψ