Im trying to generate pdf using dompdf, how can I open the pdf in a new tab in a browser? Like, I Click A link for the PDF and it should open in a new tab, not save it automatically. I want to give the user a choice to save the file after seeing it first. how do i do that?
whenever i use $pdf->output at the end of the file, it does not change a thing, the file is still downloaded automatically. please help. thanks.
I don't know if you got, but if you use false in this line:
You can see the pdf in the browser.
I have a same problem into my site (http://www.pdfwebcreator.com)
My solution is:
Am still experimenting, but something like this works fine as well
With this you can add dynamic values to your pdf file page within the browser.
Whether a PDF is downloaded or viewed in the browser depends on a couple of factors. One is your browser settings, but we have no control there. The second is how dompdf present the PDF to the browser. You can tell dompdf to offer the PDF for direct viewing using
$dompdf->stream('my.pdf',array('Attachment'=>0));
.As far as opening in a new tab. That depends on how you are generating the PDF. But the simplest way it to provide a link with a target attribute.