I used composer to install mpdf
composer require carlos-meneses/laravel-mpdf
did all the settings in config/app.php file.
The webfonts TTF files copied to resources/fonts/ folder. Added this to your configuration file (/config/pdf.php):
<?php
return [
'custom_font_dir' => base_path('resources/fonts/'), // don't forget the trailing slash!
'custom_font_data' => [
'examplefont' => [
'R' => 'fa-regular-400.ttf', // regular font
'B' => 'fa-solid-900.ttf', // optional: bold font
]
]
];
?>
used the font in view:
.fas {
font-family: 'examplefont';
}
Versions:
- PHP: 7.4
- Laravel: 7
but icons not showing in generated pdf. how can I fix this issue?
Update
Resolved by How to use Font Awesome with MPDF?