Umar Tariq
Umar Tariq

Reputation: 1297

I am trying to specify a font in a created PDF in Laravel

I am using niklasravnsborg/laravel-pdf to create a PDF file in Laravel. I'd like to use the Arial font however the font is not working.

$pdf = PDF::loadView('blade', $data, [], [
    'format' => 'A4-L',
    'orientation' => 'L'
]);

Upvotes: 3

Views: 2314

Answers (2)

Bushart hussain
Bushart hussain

Reputation: 116

I was stuck in same issue. Below is its exact solution

$pdf = PDF::loadView('blade',$data, [], [
                     format' => 'A4-L',
                     'orientation' => 'L',
                     'mode' => 'c'
                    ]);

and in blade file you should need to add on top

<style type="text/css">

    body {
        font-family: Arial, Helvetica, sans-serif;
    }
</style>

Upvotes: 6

user633440
user633440

Reputation:

You can use CSS to use a specific font.

body {
    font-family: Arial, sans-serif;
}

Upvotes: 1

Related Questions