I have a strange problem with PDF, I just can not find the PDF to show in my action. Code has been found:
$ this-> _helper-> Layout-> Disabled (); $ This- & gt; _helper-> ViewRenderer-> SetNoRender (); $ Pdf = new Zend_Pdf ('path / to / file.pdf'); $ This- & gt; GetResponse () - & gt; Set header ('content-type', 'app / x-pdf' is true); $ This- & gt; GetResponse () - & gt; Set header ('content-type', 'inline; file name = filetrace.pdf', is true); $ This- & gt; GetResponse () - & gt; SetBody ($ pdf- & gt; render ()); Zend makes this stacktrace is:
# 0 E: \ SRVApps \ Zend \ ZendServer \ Share \ ZendFramework \ Library \ Zend \ Pdf.php ( 303): Zend_Pdf_Parser-> __ construct ( 'http: // example ...', object (Zend_Pdf_ElementFactory_Proxy), false) # 1 E: \ wwwroot \ test \ htdocs \ Application \ modules \ dashboard \ controllers \ FileController.php (171): Zend_Pdf- & Gt; __ construct ( 'http: // example ...') # 2E: SRVApps \ \ Zend \ ZendServer \ Share \ ZendFramework \ Library \ Zend \ controllers \ Action.php (513): Dashboard_FileController- & gt; showAction () # 3 E: \ SRVApps \ Zend \ ZendServer \ Share \ ZendFramework \ Library \ Zend \ Administrator \ dispatcher \ Standard.php (289): Zend_Controller_Action- & gt; Dispatch ( 'showAction') # 4 e: \ SRVApps \ Zend \ ZendServer \ share \ ZendFramework \ library \ Zend \ Controller \ Front.php (954): Zend_Controller_Dispatcher_Standard- & gt; Dispatch (Object (Zend_Controller_Request_Http), objects (Zend_Controller_Response_Http)) # 5 E: \ SRVApps \ Zend \ ZendServer \ share \ ZendFramework \ library \ Zend \ Application \ Bootstrap \ Bootstrap.php (97): Zend_Controlle r_Front- & gt; Sending () # 6E: SRVApps \ \ Zend \ ZendServer \ Share \ ZendFramework \ Library \ Zend \ Application.php (366): Zend_Application_Bootstrap_bootstrap- & gt; Run () # 7E: \ wwwroot \ test \ htdocs \ public \ index.php (26): Zend_Application- & gt; Run () # 8 {main} When does a new PDF make no problem there
Does anyone have an idea?
Thanks
Method 1: Get the outside binary string of Zend_Pdf
$ file = file_get_contents ('path / to / file.pdf') $ pdf = New Zend_Pdf ($ file); Method 2: Set the $ load parameter true
$ pdf = new Zend_Pdf ( 'Path / in / file.pdf', tap, true); Method 3: Fixed load -method $ pdf = Zend_Pdf :: load ('path / to / file.pdf');
Comments
Post a Comment