I needed to display a Zend Framework generated PDF using the browser plugins and after a bit of looking around it turns out that some headers need to be set in order to achieve that.
$this->getResponse() ->setHeader('Content-Disposition', 'inline; filename=invoice.pdf') ->setHeader('Content-type', 'application/x-pdf');
If you’d want to automatically download the PDF instead of displaying it using the browser plugins, you need to change the ‘Content-Disposition’ as follows:
$this->getResponse() ->setHeader('Content-Disposition', 'attachment; filename=invoice.pdf') ->setHeader('Content-type', 'application/x-pdf');
The post HTTP response headers in Zend Framework appeared first on My Science Is Better.