Getting blank pages in laravel while using dom-pdf

Viewed 1637

I am using laravel 4.2 with dompdf. My controller:

public function getLedgerReport() {
    $pdf = PDF::loadView('sales.ledger_report')->setPaper('a4');
    $pdf->stream();
}

My view:

<?php
 ini_set('max_execution_time', 300); //300 seconds = 5 minutes
 $html = '';
 $html .= '<html><body>hi</body></html>';
 echo $html;
?>

The code which gives a 'hi' in the Pdf file.

public function getLedgerReport() {
    $pdf = PDF::loadView('sales.ledger_report')->setPaper('a4');
    $pdf->stream();
    $invoice_path = 'downloads/invoices/invoice.pdf';
    $pdf->save($invoice_path);
}

I get a blank page instead of getting a 'hi' text. But when I save the same as a pdf file I do see a 'hi' in the file.

0 Answers
Related