1

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?

Shwetha
  • 41
  • 6
  • `php artisan config:cache` help? Also, I would rather prefer the font files to be in public folder or in storage folder with a shortcut to storage folder made inside public folder. Are you trying to generate PDF on the fly? – nice_dev Sep 06 '21 at 07:09
  • @nice_dev there is no issue in folder – Shwetha Sep 06 '21 at 07:12
  • https://stackoverflow.com/questions/31432228/how-to-use-font-awesome-with-mpdf I used the steps mentioned in this but icon showing in square @arie – Shwetha Sep 07 '21 at 05:28

0 Answers0