• Magento 1 Support continued  ⋅  7-Day Money-back  ⋅  Implemented by a Magento Certified Developer 
  • On Github I support Open Source projects  with software development
  • Still on Magento 1? No problem, there is no other shop software that get you faster results!

PDF-API for Magento Developers

Magento developers can use my Advanced Invoice Layout Extension to either customize the default look'n'feel of the Magento PDF invoices, shipments and creditmemos or alternatively to implement their own PDF printing extension based on the ready-to-use vianetz PDF API.
The latter opportunity is explained here:

Implement your own PDF Extension by using the Advanced Invoice Layout PDF API

Together with the Advanced Invoice Layout Extension we bundle the vianetz PDF Engine API that enables you as a developer to build your custom solution for PDF printing, e.g. to allow users to save the product detail page in your Magento store as PDF file or to create completely individual PDF documents with easy HTML/CSS styling.
Therefore we describe the public API of the vianetz PDF Engine as follows:

Class Vianetz_Pdf_Model_Pdf:

  • addDocument(Vianetz_Pdf_Model_Document_Interface) Add a new document to the PDF instance
  • getContents() Return the PDF file contents
  • saveToFile(string) Generate and save the current PDF contents to specified file name

The magic lies in the Vianetz_Pdf_Model_Document_Interface which asks you to implement the following method:

  • getHtmlContents() Return the HTML contents that should be converted into PDF

Sample Usage


class Your_Document implements Vianetz_Pdf_Model_Document_Interface {
     * This fetches the product detail page content for product id 1.
     * You can return any kind of HTML content here.
    public function getHtmlContents()
        $block = Mage::getBlockSingleton('catalog/product_view')

        return $block->toHtml();

// Create a new pdf instance.
$pdf = new Vianetz_Pdf_Model_Pdf();

// Add our document class. You can add as many documents as you like
// as they will all be merged into one PDF file.
$pdf->addDocument(new Your_Document());

// Save the resulting PDF to file test.pdf - That's it :-)

Please get in touch with us if you have any questions.