I am using DOMpdf to generate a PDF and then save it both in the database and in the Storage folder, when I generated the < strong> PDF test, this is rendered without problems, but when I try to generate my view, it lasts forever.
//esto genera el PDF sin problemas
$pdf = App::make('dompdf');
$pdf->loadHTML('<h1>Test</h1>');
return $pdf->stream();
//Esto tarda por siempre
$html = View::make('miVista')->with('miVariable',$miVariable);
$pdf = PDF::loadHTML($html);
return $pdf->stream();
This way it also loads forever:
$data['miVariable'] = $miVariable;
$pdf = PDF::loadView('miVista',$data);
return $pdf->stream();
When I try to generate the HTML or view without variables, I get an error:
unlink (C: \ Users \ myuser \ AppData \ Local \ Temp / 912627fa8ee0eef3c82086a0d4462c2e): Permission denied
What can be done? Is there a better PDF generator? I have read about Mdpf but I do not know how to integrate it with Laravel .
Edition
The version you installed was v0.6.2 , and I'm using laravel 4.2 , install it following the instructions for 4.x versions of dompd , using the facade does not work, and using download
instead of stream
does not work either.