Schnelle Lösung um verschieden Content-types mit Zend zu versendenQuick solution to send custom content types in Zend Framework

In your controller action simply use:

// disable default layout rendering
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();    	 
    	
// e.g. for PDF
$this->getResponse()
             ->setHeader('Content-Disposition', 'inline; filename=result.pdf')
             ->setHeader('Content-type', 'application/pdf');
    	
// finally send content based on custom content-type
$this->getResponse()->setBody($pdf->render());

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.