barryvdh / laravel-dompdf

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

Issue with loadFile when converting HTML to PDF #979

Closed lucapellegrino70 closed 1 year ago

lucapellegrino70 commented 1 year ago

Hello, I am trying to convert html to pdf as follows:

use Barryvdh\DomPDF\Facade\Pdf;

$pdf = app()->make('dompdf.wrapper'); $pdf = \PDF::loadFile(public_path('templates/myfile.html)); $pdf->setPaper('A4', 'portrait'); $pdf->save(public_path('templates/blabla.pdf));

This code was working but since I updated Laravel and Barryvdh is not working anymore, it gives error in loadfile

How can I solve this?

Thank you

parallels999 commented 1 year ago

How can I solve this?

Reading documentation, there was a major release

Also your code, it is very badly done, use markdown too

use Barryvdh\DomPDF\Facade\Pdf;

$pdf = Pdf::loadFile(public_path('templates/myfile.html'))
        ->setPaper('A4', 'portrait')
        ->save(public_path('templates/blabla.pdf'));
lucapellegrino70 commented 1 year ago

@parallels999 I already tried but still get error

Dompdf\Exception: Permission denied on \public\templates/myfile.html. The communication protocol is not supported. in file \vendor\dompdf\dompdf\src\Dompdf.php on line 350

parallels999 commented 1 year ago

Permission denied

Search for that, or ask on the real package, this is only a wrapper

lucapellegrino70 commented 1 year ago

thanks

mdoulabi1 commented 9 months ago

same here