Home  >  Q&A  >  body text

Browse PDF files without downloading, using dompdf

<p>I generated a PDF using the dompdf library and used this: </p> <pre class="brush:php;toolbar:false;">$dompdf->stream('my.pdf',array('Attachment'=>0));</pre> <p>Force the browser to let users view the PDF before downloading. But this doesn't work. A Google search didn't give any answers either. Can anyone help? </p>
P粉541796322P粉541796322439 days ago481

reply all(2)I'll reply

  • P粉878510551

    P粉8785105512023-08-28 16:34:53

    If anyone is still looking for an answer and it still doesn't solve the problem, try installing and opening the PDF Viewer/PDF JS extension in your browser.

    After adding the parameter array("Attachment"=>0) or array("Attachment"=>false) to the stream, it still doesn't work. . This is because your browser does not have a pdf reader available/activated. Installing and activating browser extensions such as PDF Viewer / PDFJS will force the browser to read and review pdfs.

    reply
    0
  • P粉473363527

    P粉4733635272023-08-28 00:45:40

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

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

    reply
    0
  • Cancelreply