Domanda

I have tried as following in magento 1.7

 $pdf = new Zend_Pdf(); 
  ....
  ....
 $pdfString = $pdf->render();
 header("Content-Disposition: attachment; filename=helloworld.pdf");
 header("Content-type: application/x-pdf");
 echo $pdfString;

Now the issue is that when PDF is generated it throws error message: Pdf does not begin with %PDF-1.4. Also I noticed that it contains html contents. Can anyone please tell me what should I do in order to avoid html contents from being appended with Pdf's own contents.

È stato utile?

Soluzione

Duplicate of zend_pdf document issue in windows 7

Stick ob_end_clean() before the echo statement.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top