view pdf without downloading using dompdf

OJuice picture OJuice · Jul 15, 2014 · Viewed 37.5k times · Source

I generated a PDF using the dompdf library and used this:

$dompdf->stream('my.pdf',array('Attachment'=>0));

to force the browser to let the user view the PDF before downloading. But it's not working. A Google search isn't bringing up any answers either. Can anyone help?

Answer

Nithyanandhan M picture Nithyanandhan M · Jul 15, 2014

Try using the below code. Let me know are you create data from form or html file data.

$dompdf->stream("dompdf_out.pdf", array("Attachment" => false));

exit(0);