Browse PDF files without downloading, using dompdf
P粉541796322
2023-08-27 21:37:21
<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>
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)
orarray("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.Try using the code below. Let me know if you are creating the data from form or html file data.