I am using Magento CE 1.7.0.2 and would like to alter some parts of the .pdf invoices that can be printed from the 'invoices' section of the site.
As you can see in the image above, I would like to alter the colours of the grey area towards the top as well as remove the reference to shipping charges in the 'Shipping Methods' section.
Any pointers would be really useful as this is proving really hard for me.
Thanks for any and all replies.
UPDATE.
To get rid of the 'Total Shipping Charges' section…
Moved:
app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php
to
app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php
then on line 445
altered:
$totalShippingChargesText = "(" . Mage::helper('sales')->__('Total Shipping Charges') . " "
. $order->formatPriceTxt($order->getShippingAmount()) . ")";
to:
$totalShippingChargesText = "";
Best Answer
In the same file the Mage_Sales_Model_Order_Pdf_Abstract::insertOrder method is what draws the header part of the PDF. To change gray background to white, change:
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0.45));
to
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
before the line
$page->drawRectangle(25, $top, 570, $top - 55);
To change color to black in the same file change:
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
to
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
right after
drawRectangle
call.You will have to do the same in
Mage_Sales_Model_Order_Pdf_Abstract::insertDocumentNumber()
because that is where Invoice # is added.With all of the above said, you are better off with doing local module which overrides the abstract class or the invoice class. And in it just change what you need. This way in case of future changes in the Abstract.php file in core code pool you will inherit new features and retain your changes as well.