To add new font Arvo in DOMPdf I updated file dompdf_font_family_cache.dist and added following code -
'arvo' =>
array (
'normal' => DOMPDF_FONT_DIR . 'Arvo-Regular',
'bold' => DOMPDF_FONT_DIR . 'Arvo-Bold',
'italic' => DOMPDF_FONT_DIR . 'Arvo-Italic',
'bold_italic' => DOMPDF_FONT_DIR . 'Arvo-BoldItalic',
),
I included font files in lib/fonts directory I added style sheet in html -
font-family: arvo;
But new font is not added in result pdf. Please help me to resolve this problem.
Instead of manually modifying dompdf_font_family_cache you should use load_font.php or (in dompdf 0.6.0 beta 3) the web-based installer located at www/fonts.php.
In my case, I solved it:
Installing load_font.php from here: https://github.com/dompdf/utils/blob/master/load_font.php
1.1. Create a new file in your root folder from your project and save.
1.2. Next, run this line in your command line: php load_font.php FONTNAME FONTPATH/fonts/EXAMPLEFONT.ttf
Search and open the file dompdf_font_family_cache.php and update your file in this way (eg):
'poppins' =>
array(
'normal' => $rootDir . '\lib\fonts\Poppins-Light_0',
),
Go to your PDF and use your font.
These few steps maybe solve the issue. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With