lun7code
lun7code

Reputation: 199

Laravel pdf issue: failed to open stream: No such file or directory by using barryvdh/laravel-dompdf package

I am update composer and use barryvdh/laravel-dompdf package.

the problem is when i click the button it show me error like image below:-

enter image description here

Is that anyway to change the folder path? or am I missing code to modify path to download the pdf file?

Upvotes: 5

Views: 18486

Answers (4)

mustafa abdsh
mustafa abdsh

Reputation: 11

Note: This directory must exist and be writable by the webserver process. under the config file thats what it say: therefore you should create the fonts directory inside the storage.

    "font_cache" => storage_path('fonts/'),

Upvotes: 1

Haroon Mahmood
Haroon Mahmood

Reputation: 381

Try this:

$pdf = PDF::loadView('pdf/personalpdf', compact('user','result'))->setOptions(['defaultFont' => 'sans-serif']);

It worked for me, I didn't make any file/folder

Upvotes: 4

genarocupil
genarocupil

Reputation: 51

Just remove the reference to css external file in your cart.placeOrder.blade

Upvotes: 0

Hiren Gohel
Hiren Gohel

Reputation: 5041

You need to run this command:

php artisan vendor:publish

Then, try to create a fonts directory in the storage directory.

i.e. storage/app/fonts. Also, remember to make it writable.

For maximum execution time of 30 seconds exceeded, this is not laravel related issue but it's about php configuration issue. Please see this and fix it: http://php.net/manual/en/info.configuration.php#ini.max-execution-time

You can also see this answer: https://stackoverflow.com/a/30290770/6000629

Hope this will helps you!

Upvotes: 9

Related Questions