barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.62k stars 965 forks source link

dompdf_font_family_cache missing when trying to load and save a PDF view #987

Open engel-m opened 1 year ago

engel-m commented 1 year ago

Hi, I am on Laravel 10 (upgraded from 8 -> 9 -> 10), and on 2.0.1 of laravel-dompdf. Since the upgrades, I get the following errors when trying this simple command:

            use Barryvdh\DomPDF\Facade\Pdf;

            $pdf = Pdf::loadView('pdf-label-template', ['shipment' => $shipment]);

            $savePath = storage_path('app/shippinglabels/' . $shipment->id . '.pdf');

            $pdf->save($savePath);
Log error
require(/home/forge/***sitename***/vendor/dompdf/dompdf/lib/fonts/dompdf_font_family_cache.dist.php): Failed to open stream: No such file or directory

directly followed up by:

TypeError
Illuminate\Database\QueryException::__construct(): Argument #3 ($bindings) must be of type array, PDOException given, called in /home/forge/***sitename***/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 760

On Laravel 8 with laravel-dompdf 1.x, this worked fine.

I can not find this file that it asks for anywhere, also not in my local environment. I tried everything, also setting the directory permissions, and removing the whole package, clearing composer cache and installing again. This also did not work.

parallels999 commented 1 year ago

dompdf_font_family_cache.dist.php was removed on dompdf:^2.0 https://github.com/barryvdh/laravel-dompdf/blob/424a223ce80e7afc8bfb6e84449679efe272fbb5/.github/ISSUE_TEMPLATE/bug_report.md?plain=1#L10-L12

This is just a Dompdf wrapper! I understand that this package is just a Laravel wrapper for https://github.com/dompdf/dompdf Any issues with PDF rendering, CSS that is not applied correctly, aligning/fonts/characters etc that are not directly related to this package, should be reported there. When having doubts, please try to reproduce the issue with just dompdf. If it's also present there, do not open an issue here please.

engel-m commented 1 year ago

dompdf_font_family_cache.dist.php was removed on [dompdf:^2.0]

I am running the latest version of laravel-dompdf, which installs and uses dompdf 2.0.3 as a dependency. But how then does it still look for dompdf_font_family_cache.dist.php, if dompdf does not use it anymore?

parallels999 commented 1 year ago

https://github.com/barryvdh/laravel-dompdf/blob/424a223ce80e7afc8bfb6e84449679efe272fbb5/.github/ISSUE_TEMPLATE/bug_report.md?plain=1#L10-L12

This is just a Dompdf wrapper! I understand that this package is just a Laravel wrapper for https://github.com/dompdf/dompdf Any issues with PDF rendering, CSS that is not applied correctly, aligning/fonts/characters etc that are not directly related to this package, should be reported there. When having doubts, please try to reproduce the issue with just dompdf. If it's also present there, do not open an issue here please.