5

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?

lun7code
  • 199
  • 1
  • 3
  • 14
  • You can Include .utm. it is file not found – Sagar Patel Nov 19 '18 at 06:37
  • I think not this problem. Not using any .ufm format extension – lun7code Nov 19 '18 at 06:40
  • Have you ran command: `php artisan vendor:publish` ?? – Hiren Gohel Nov 19 '18 at 06:42
  • ufm is a font file. Make sure all fonts used in cart.placeholder are installed on your system. – Elie Nov 19 '18 at 06:42
  • @lun7code: Try to create a `fonts` directory in `storage` directory i.e. `App/storage/fonts....` Also, remember to make it writable. – Hiren Gohel Nov 19 '18 at 06:46
  • 1
    Hi @HirenGohel, Yes. it work but now have another issue is 'Maximum execution time of 30 seconds exceeded' – lun7code Nov 19 '18 at 06:49
  • @lun7code: The Maximum execution time of 30 seconds exceeded error is not related to Laravel but rather your PHP configuration. Please see this: http://php.net/manual/en/info.configuration.php#ini.max-execution-time – Hiren Gohel Nov 19 '18 at 06:50
  • You Can You External Font like "". It Is not Working – Sagar Patel Nov 19 '18 at 13:00
  • you can check this link for better solution . https://stackoverflow.com/questions/60795346/how-to-save-dompdf-file-to-storage-and-name-the-file-dynamicly-in-laravel/74942859#74942859 – pankaj Dec 28 '22 at 16:48
  • you can check this link for better solution . https://stackoverflow.com/questions/60795346/how-to-save-dompdf-file-to-storage-and-name-the-file-dynamicly-in-laravel/74942859#74942859 – pankaj Dec 28 '22 at 16:49
  • you can check this link for better solution . https://stackoverflow.com/questions/60795346/how-to-save-dompdf-file-to-storage-and-name-the-file-dynamicly-in-laravel/74942859#74942859 – pankaj Dec 28 '22 at 16:49

4 Answers4

9

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!

Hiren Gohel
  • 4,942
  • 6
  • 29
  • 48
  • From Laravel 5.x, the correct path for storage directory is at the root. In my case, using Laravel 5.7 was not necessary run vendor:publish command. – manuelpgs Nov 26 '19 at 14:47
  • @herohat: Yes, my bed :), the `storage` folder is in root, and the path is `storage/app/`. Thanks for looking in it :) – Hiren Gohel Nov 27 '19 at 04:16
4

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

Haroon Mahmood
  • 341
  • 3
  • 6
1

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/'),
0

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