Skip to content

Differents on generated pdfs, locally and on production, using dompdf #3250

Answered by aldzic4
aldzic4 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks a lot for your help.
I removed installed-font.json file, but also this is how I imported fonts in my function where pdf is generated.

$options = new Options();
$options->set('defaultFont', 'FagoPro'); // Set the default font (first font you want to use)
$options->set('isHtml5ParserEnabled', true); // Enable HTML5 parser
$dompdf = new Dompdf($options);
$fontMetrics = new FontMetrics($dompdf->getCanvas(), $options);
$fontMetrics->registerFont(
    [
        'family' => 'FagoPro-Bold',
        'style' => 'normal',
        'weight' => 700,
        'file' => storage_path('fonts/FagoPro-Bold.otf'),
    ],
    storage_path('fonts/FagoPro-Bold.otf')
);

This is in blade.php file inside <st…

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@bsweeney
Comment options

@aldzic4
Comment options

@bsweeney
Comment options

@aldzic4
Comment options

Answer selected by aldzic4
@bsweeney
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants