Edit the Magento Invoice PDF Templates

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.

15 Responses to “Edit the Magento Invoice PDF Templates”

  1. Ronny Anthony Says:

    Cool information!!! Thanks!

  2. Kevin Godden Says:

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

    Kev.

  3. Matt Says:

    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!

  4. Terminology software developer Says:

    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”

  5. Arno Smit Says:

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

  6. Terminology Software Says:

    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);

  7. Super-tees Says:

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

  8. R3Nd3r Says:

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

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

  9. m4t Says:

    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?

  10. Ragento Says:

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

  11. pdf invoice Says:

    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?

  12. Sim Says:

    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.

  13. James Thompson Says:

    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.

  14. Kindermode Says:

    Very helpfull, that was the Step to help me

  15. Ken Says:

    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.

Leave a Reply