$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. – Kristof at Fooman Feb 17 '16 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 '16 at 7:41


 $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';
| improve this answer | |

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.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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