How to print preview first before download the pdf file. Below is my code , please suggest me if any...

684 views
Skip to first unread message

online

unread,
Oct 15, 2018, 10:09:55 PM10/15/18
to dompdf

 $dompdf = new Pdf();
$file_name = 'Invoice-'.$row["order_no"].'.pdf';
$dompdf->loadHtml($output);
$dompdf->render();
$dompdf->stream($file_name, array('Attachment' => 0 ));
exit(0);
 }
?>


BrianS

unread,
Dec 28, 2018, 9:37:49 PM12/28/18
to dompdf
Not sure what issue you're trying to solve.

If you want to preview the PDF with an option to download there's not really an easy way to do that. Maybe use a pop-up or modal to load the generated PDF inline (rather than as a downloadable attachment).

If your issue is that the browser doesn't display the PDF but instead just downloads it I don't think there's much else you can do. Your code is correct, but the actual handling of the PDF is controlled by the browser. If the browser doesn't have PDF viewing capability it will download the file.
Reply all
Reply to author
Forward
0 new messages