$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoicesSet);
'.pdf', $pdf->render(), 'application/pdf');   

I am trying to download all invoice in PDF and need to Save in Magento root folder.

But it's downloading in browser only.

Can any one help for this issue.

  • 2
    Please don't save it into the root folder as pdfs in the root folder would be downloadable. Feb 17, 2016 at 7:34
  • Thanks for valuable reply, Can you please provide any way for "How can i download the PDF file in to magento root folder ?"
    – Ramesh
    Feb 17, 2016 at 7:41

2 Answers 2



 $this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s'). '.pdf', $pdf->render(), 'application/pdf'); 

would send it to the browser. The below would write to a file in the var directory instead:

$name = 'invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s'). '.pdf';

You can try with this method

$pdf->save(Mage::getBaseDir('var'). DS . 'tmpfolder' . DS 'filename.pdf');

This will save a local copy, just be aware folder permissions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.