I am trying to generate a pdf in laravel and then set the font-family in the css of the page so that the generated pdf uses this font-family. I am using this package: https://github.com/barryvdh/laravel-dompdf alongside laravel.
My api does the following:
$pdf = Pdf::loadView('myview', ['view1' => $view1, 'view2' => $view2]);
return $pdf->stream('myview.pdf');
myview is a blade file that i am streaming to create the pdf. Above my body and below my head i have the following:
`
* {
font-family: 'DejaVuSans';
}
`
My ttf file is in: vendordompdfdompdflibfontsDejaVuSans.ttf. Which according to the documentation is correct.
I’ve tried different ways of writing it such as by adding sans-serif and adding a space but its all the same issue.
I also tried moving the font folder to my storage/fonts folder but i had the same issue. What i need is for the font to be set on load so that the greek and russian text appears correctly as it is currently appearing as ?????????
2
Answers
I have used this in my project you can try it.
i think you’r trying to generate pdf using arabic right ? if so use https://github.com/niklasravnsborg/laravel-pdf
and font family : cairo