Monday, March 20, 2017

why dompdf inside laravel 4.2 failes to load html string?

Inside the laravel controller, When I do this

$html = '<h1><a name="top"></a>mPDF</h1>
                <h2>Basic HTML Example</h2>
                This file demonstrates most of the HTML elements.
                <h3>Heading 3</h3>
                <h4>Heading 4</h4>
                <h5>Heading 5</h5>
                <h6>Heading 6</h6>
                ';

        $pdf = App::make('dompdf');
            $pdf->loadHTML($html);
           $pdf->save('my_stored_invoice.pdf')

It works perfectly.

But when i do this

$pdf = App::make('dompdf');
$pdf->loadView('pdf.invoice');
$pdf->save('my_stored_invoice.pdf');

My browser crashes with the calling url, Also apache got slowed down. I have set INI limit 2048 MB. Please suggest me some way to get out of this problem. Thanks in advance.



via Jaydeep Marvaniya

Advertisement