Magento – Remove tax from the invoice pdf

magento-1.7

I've been trying to remove this single line(Tax: ) from the invoice pdf. It didn't know it's going to be so hard and going cost me 5 hours and I am still stuck.

Its the print button in sales invoice.. in Admin

enter image description here
Please help!
Note: These are the vertical rows on the bottom of the pdf I can remove the tax from the horizontal row above this

My last try was

placing in if($totalInfo['source_field'] == 'tax_amount') {continue;} foreach below()

In _getTotalsList($Source) in Mage_Sales_Model_Order_Pdf_Abstract (Which I am gonna override later)

    protected function _getTotalsList($source)
{
    $totals = Mage::getConfig()->getNode('global/pdf/totals')->asArray();
    usort($totals, array($this, '_sortTotalsList'));
    $totalModels = array();
    foreach ($totals as $index => $totalInfo) {

if($totalInfo['source_field'] == 'tax_amount') {continue;}

        if (!empty($totalInfo['model'])) {
            $totalModel = Mage::getModel($totalInfo['model']);
            if ($totalModel instanceof Mage_Sales_Model_Order_Pdf_Total_Default) {
                $totalInfo['model'] = $totalModel;
            } else {
                Mage::throwException(
                    Mage::helper('sales')->__('PDF total model should extend Mage_Sales_Model_Order_Pdf_Total_Default')
                );
            }
        } else {
            $totalModel = Mage::getModel($this->_defaultTotalModel);
        }
        $totalModel->setData($totalInfo);
        $totalModels[] = $totalModel;
    }

    return $totalModels;
}

but it didn't work.

Best Answer

Kudos for giving it a real shot!

Create a new module rewriting Mage_Sales_Model_Order_Pdf_Invoice. Copy/paste that model to your local module and remove any line that reads as follows:

$page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8');

You may have to reorganize the other totals as they're building up in a vertical column. Changing the value of the second parameter (480 above) in the other totals should be easy enough.

This solution will cover invoice PDFs. You were working in Abstract, which may suggest you want it removed everywhere. In that case, I would rewrite the other PDF implementations. They're all located in the same directory but with the names Creditmemo.php, Shipment.php.