Question

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.

Was it helpful?

Solution

Duplicate of zend_pdf document issue in windows 7

Stick ob_end_clean() before the echo statement.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top