views:

62

answers:

1

Hi. I have the following code inside my controller but I can't open the pdf it produces.

    $html = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head><body>trial</body></html>";

    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream("sample.pdf");  

It works when used outside the framework but I don't know how to check how the pdf is mangled in any way. Any help will be appreciated!

EDIT:

I'm using Zend Framework 1.10 and followed this tutorial

http://www.encapsulated.org/blog/2009/08/27/how-to-let-dompdf-and-zend-framework-play-along/
A: 

Found the solution:

    $this->_helper->layout->disableLayout();        
    $this->_helper->viewRenderer->setNoRender();

I disabled the layout and viewscript inside the action generating the pdf.