Dompdf, does not generate the PDF, just upload forever?

0

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.

    
asked by Carlos Salazar 12.10.2017 в 21:56
source

1 answer

0

For Laravel 4 you must install version 0.4, you can replace this line in your composer and run composer update

"barryvdh/laravel-dompdf": "0.4.*"

And try using it like that, I assume that your view is in the myVista folder and it is index.blade.php , you make the relevant modification: p>

$pdf = \PDF::loadView('miVista.index', $miVariable);
return $pdf->stream();
    
answered by 26.10.2017 в 19:06