Edit the Magento Invoice PDF Templates

December 2nd, 2008 Posted in Programming

Code Location

  • /app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php
  • /app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php

Changing the font size

Change the font size in the two files:

  • /app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php (line 487-507)
  • /app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php (line 255-274)

Change the invoice logo

  • Admin -> Configuration -> Sales -> Invoice and Packing Slip Design

More info

  • Changing the invoice size from A4 to letter
  • Changing the font from Libertine to Helvetica
  • Read up here.
  1. 18 Responses to “Edit the Magento Invoice PDF Templates”

  2. By Ronny Anthony on Jan 13, 2009

    Cool information!!! Thanks!

  3. By Kevin Godden on Feb 3, 2009

    Hi, Just the very information I was looking for – Thanks!

    Kev.

  4. By Matt on Mar 6, 2009

    How do I change the line spacing for the address and the size of the logo? Also for some reason the Grand Total and the product line font size still stays at 7pts.
    thanks for any help!

  5. By Terminology software developer on May 18, 2009

    Is it possible to generate invoice pdf without zlib extension?
    I tried to comment out logo and some other stuff but nothing changes, i receive an error from Zend Framework pdf code: “You have to use zlib extension”

  6. By Arno Smit on Aug 19, 2009

    How would i go about adding something like the customers tax/vat number on the invoice?

  7. By Terminology Software on Sep 2, 2009

    You can get customer TAX/VAT value like that:

    $customer = Mage::getModel(‘customer/customer’)->load($order->getData(‘customer_id’));
    $taxVat = $customer->getData(‘taxvat’);

    Then you can write it into right place in pdf document like that:

    $page->drawText($taxVat);

  8. By Super-tees on Oct 23, 2009

    Exactly what I was looking for, thanks a bunch dude!

  9. By R3Nd3r on Nov 9, 2009

    but aren’t those templates gone with the next update?

    is there a way to put them inside the template folder itself ?

  10. By m4t on Nov 17, 2009

    This:

    $customer = Mage::getModel(’customer/customer’)->load($order->getData(’customer_id’));
    $taxVat = $customer->getData(’taxvat’);

    works only for registered user. How can I get tax/vat number for guest customer?

  11. By Ragento on Nov 17, 2009

    How would i go about adding a attribute like ‘manufacturer’ on the invoice?

  12. By pdf invoice on Nov 26, 2009

    how do you switch shipping costs with total tax, now shipping costs is displayed below total tax, i want to switch these two in the pdf layout, because now it is confusing. In checkout page it’s all shown ok, but not in the invoice screen in backend and also in the pdf printout the shipping costs and tax are switched… How to resolve this?

  13. By Sim on Jan 21, 2010

    How would one go about getting the invoiced date so i can add to the invoice. It is a requirments by law in Australia for the invocied date to be present on our tax invoices or else it is an illegal invoice. There are other requirments that i needed to address, but have managed to get them all sorted, just missing the invoiced date.

  14. By James Thompson on Jan 27, 2010

    Before making any changes to the template files be sure to copy them into

    ยป /app/code/local/Mage/Sales/Model/Order/Pdf/…..etc

    That way they won’t be overwritten when you upgrade. Never change anything in app/code/core or you will be in a big mess when it comes to upgrades.

  15. By Kindermode on Feb 21, 2010

    Very helpfull, that was the Step to help me

  16. By Ken on Mar 8, 2010

    Still trying to change the font size below the QTY Products SKU area.
    i changed the abstract.php in the items folder but i get no changes.

  17. By Barracuda Lures on May 17, 2010

    Thanks for the helpful advice. Our lure store customers will appreciate the Barracuda logo on our invoice

  18. By Geek Tees on May 29, 2010

    Could anyone shed any light on increasing the line-height? I have managed to increase the font-size but can’t seem to find the right var for the line-height?

  19. By Jonathan on Jun 8, 2010

    Very helpfull for VAT ;)

    TY

Post a Comment