jeudi 17 juin 2021

Update pdf which is open in laravel

I'm creating pdf file using DOM pdf, it is working but when i try to recreate it with same name and the pdf file is open then i'm getting this error message:

message: exception: "ErrorException" file: "C:\xampp\htdocs\xxxxxxx\vendor\league\flysystem\src\Adapter\Local.php" line: 199"file_put_contents(C:\xampp\htdocs\XXXX\storage\app\public/pdf/salary/40_file-2021.pdf): failed to open stream: Resource temporarily unavailable" trace: [{function: "handleError", class: "Illuminate\Foundation\Bootstrap\HandleExceptions", type: "->"},…]

             $dompdf = new Dompdf();
             $dompdf->set_option('isHtml5ParserEnabled', true);
             $dompdf->set_option('isRemoteEnabled', true);  
             $html = view('admin/pdf',['data'=>$data_new])->render();
             $dompdf->loadHtml($html);
             $dompdf->setPaper('A4', 'portrait');
             $dompdf->render();
             $fileName = 'pdf/salary/'.$data_new->user_id.'_'.$data_new->application_id.'.pdf';
             Storage::put('public/'.$fileName, $dompdf->output());

Any suggestion is highly appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire