0
votes

Could you help me please to solve my problem. I have to use zend Framework to generate Pdf files. i choose to use FPDF library to do it. When i try to generate Pdf, i get the message below :

%PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream x???Mn۰ ???,:&? ?s ?h?? ?e6?Ŧlː? ?U??[t Ų-ۚD+IC~|????߮ f ??E! ??Q ?'2? ????ڵ?+(ޅfќ@? ~H? ?Ң?I?H? iyƬ( 4???]Ymⳑ????????-??B3??z?IZ ?La&#1223;?Y?t k%sI???? &#27000;L9?7&#1451;&#1322;???? _?E??$E? ?'?N&#1865;?y?; ,?&#1216;X?? m}&#42169;&#22800;e?????4ԁ搭Ὤ? ???Ϳ?ꢮ?1?ʮ ,;A ǐ ny آr ?B?????謐"Ɇ?E ˕ɍ??=ɪ踀Dµ?Ӟصe?޶}_IJ? m?,?? hYmx?? Ňy7?G?Č???] my`9Bㆥ?8䣖m[???Ĩ ?? ~??Ѓ1??媵}fo8僀f ]v!?>?iY?p/(Ej??n?????'?c?O??h?$䳹Ӽ¬???\ ?ER)DJ)? ?}?FN?q:?ˊY????㮘? 봐轊 Ø??Йx?͡7?᫘?K???? endstream endobj 1 0 obj <> endobj 5 0 obj <> endobj 2 0 obj << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] /Font << /F1 5 0 R >> /XObject << >> >> endobj 6 0 obj << /Producer (FPDF 1.7) /CreationDate (D:20120427161022) >> endobj 7 0 obj << /Type /Catalog /Pages 1 0 R >> endobj xref 0 8 0000000000 65535 f 0000000725 00000 n 0000000908 00000 n 0000000009 00000 n 0000000087 00000 n 0000000812 00000 n 0000001012 00000 n 0000001087 00000 n trailer << /Size 8 /Root 7 0 R /Info 6 0 R >> startxref 1136 %%EOF

I searched the web but i haven't find a solution, so i tried to generate my files with Zend_PDF but i got the same message and not a pdf file. Please help! Thanks

1

1 Answers

1
votes

Looks like you're not setting your headers correctly, I'm guessing you're using render() in Zend_PDF so try adding this in place on your current render()

$this->getResponse()->setHeader('Content-type', 'application/x-pdf', true);
$this->getResponse()->setHeader('Content-disposition', 'inline; filename=my-file.pdf', true);
$this->getResponse()->setBody($pdf->render());

See Zend Framework PDF problems