I'm looking for a way to export product data and attributes from the product page via an export to PDF button. Are there any reliable extensions around as a solution?

I'm currently looking at the following 2 extensions:

Global PDF: http://www.boostmyshop.com/english/global-pdf.html

Magazento: http://www.magazento.com/english/magento-ext/magazento-extensions/pdf-export

| improve this question | | | | |

I have suggest simple solution. I think you want the link at product detail page. when some user click on the Download PDF Button then it will generate the PDF of that product only.

For that you have to create one Helper Class. Suppose your Namespace will be Test and Module name will be Generatepdf.

Step 1: Create the module Configuration file in \app\etc\modules\Test_Generatepdf.xml as below.

<?xml version="1.0"?>

Step 2: Create the Module Configuration file in \app\code\local\Test\Generatepdf\etc\config.xml as below.

<?xml version="1.0"?>

Step 3: Create the Helper Class with below code in \app\code\local\Test\Generatepdf\Helper\Data.php.

class Test_Generatepdf_Helper_Data extends Mage_Core_Helper_Abstract
   public function generatePdfFile($_product){
       $this->_isExport = true;
       $pdf = new Zend_Pdf(); 
       $pdf->pages[] = $pdf->newPage(Zend_Pdf_Page::SIZE_A4); 
       $page=$pdf->pages[0]; // this will get reference to the first page. 
       $style = new Zend_Pdf_Style(); 
       $style->setLineColor(new Zend_Pdf_Color_Rgb(0,0,0)); 
       $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES); 
       // Hear Add your data as per your requrement.
       // Blank page and pdf headers 
       header('Content-type: application/pdf'); 
       header('Content-Disposition: attachment; filename="downloaded.pdf"'); 

       // Browser watch 
       echo $pdf->render(); 

Step 4: access this method in product Detail Page. Make Sure you must have to pass the $_product Object.


Enjoy :)


If you pass the Product ID in parameter and Load the Product Collection on helper you got the all the detail of product Detail with all available attributes. You can modify this function as per your Requirement.

| improve this answer | | | | |
  • ok no problem :) – Keyul Shah Jun 16 '14 at 3:08
  • @KeyulShah : I followed and got" ( ! ) SCREAM: Error suppression ignored for ( ! ) Fatal error: Class 'Mage_Test_Helper_Data' not found in D:\wamp\www\magento\app\Mage.php on line 547" > Please check once – TBI Infotech Jun 16 '14 at 6:59
  • I have Update the code – Keyul Shah Jun 16 '14 at 7:09
  • Yes the change removes the error but I think the pdf, still needs to be modified, not sure if my system is not configured properly, hopefully you have tested it! – TBI Infotech Jun 16 '14 at 7:39
  • 1
    That's y I mention that you have to change the pdf script code as per your requirement – Keyul Shah Jun 16 '14 at 8:32

This may need some alteration



, add the following function

public function getPdfFile(){
        $this->_isExport = true;

        $pdf = new Zend_Pdf();
        $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
        $page->setFont($font, 12);
        $width = $page->getWidth();
        foreach ($this->_columns as $column) {
            if (!$column->getIsSystem()) {
                $header = $column->getExportHeader();                
                $page->drawText($header, $i, $page->getHeight()-20);                
                $width = $font->widthForGlyph($font->glyphNumberForCharacter($header));
        $pdf->pages[] = $page;
        return $pdf->render();


public function exportPdfAction(){
        $fileName = 'products.pdf';        
//check grid for product once if it breaks.        
$content = $this->getLayout()->createBlock('adminhtml_catalog_product_grid')->getPdfFile();
        $this->_prepareDownloadResponse($fileName, $content);


$this->addExportType('*/*/exportCsv', Mage::helper('catalog/product')->__('CSV'));
$this->addExportType('*/*/exportXml', Mage::helper('catalog/product')->__('Excel XML'));

Add the PDF Export

        $this->addExportType('*/*/exportCsv', Mage::helper('catalog/product')->__('CSV'));
        $this->addExportType('*/*/exportXml', Mage::helper('catalog/product')->__('Excel XML'));
        $this->addExportType('*/*/exportPdf', Mage::helper('catalog/product')->__('PDF'));

Now refresh the admin, you can export products as PDF.

Please let me know if it works.

| improve this answer | | | | |
  • They need pdf export functionality in product detail page not in backend grid. – Keyul Shah Jun 22 '14 at 0:45
  • @TBI Infotech ok. i will try and let you know. – HungryDB Nov 10 '14 at 9:23
  • I got 500 internal server error. Did i miss something or code need to be reviewed. – HungryDB Nov 10 '14 at 9:49

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.