magento invoice pdf header on every pdf pages

magento invoice pdf header on every pdf pages

October 8, 2026 · Illustrated author avatarBy Stefan Bogdanescu
magento invoice pdf header on every pdf pages

Adding Logo and Address to Every Page of Magento Invoice PDF

As an e-commerce developer, I often encounter clients who want their company logo and address printed on every page of the invoices generated by Magento. While Magento allows you to set these details in the admin panel, they are not automatically replicated across multiple pages in a multi-page invoice.

The Default Behavior

By default, Magento only prints your logo and address information at the top of the first page. Subsequent pages will be missing this header information, which can look unprofessional and confusing for your customers.

Why Your Current Footer Code Isn’t Helping

You’ve correctly identified that you need to modify the app\code\core\Mage\Sales\Model\Order\Pdf\Invoice.php file. However, the solution from the Magento StackExchange question you referenced is only for adding a footer image—not for replicating the header information across pages.

The Solution: Override and Customize

To solve this issue, we need to override the drawHeader() method in your custom app\code\local\Mage\Sales\Model\Order\Pdf\Invoice.php file. Here’s a step-by-step guide:

  1. Create Your Custom File: Create a new directory structure under app\code\local\Mage\Sales\Model\Order\Pdf. Inside this directory, create the Invoice.php file.
namespace Mage\Sales\Model\Order\Pdf;

class Invoice extends \Mage_Sales_Model_Order_Pdf_Invoice
{
    // Your custom code here
}
  1. Override the drawHeader Method: Open your new Invoice.php file and override the drawHeader() method as shown below:
public function drawHeader($page)
{
    $this->y = 580; // Starting y-coordinate for the header

    // Your custom logo and address code here

    // Rest of the default drawHeader() method remains unchanged
}
  1. Add Your Logo and Address: Within the drawHeader() method, you need to manually add your logo image and text (address) using the $this->setFont() and $this->drawText() methods.

Here’s an example:

$this->y -= 10; // Adjust the starting y-coordinate
$this->setFont('Arial', 'B', 9);
$this->drawText($this->_left, $this->getY(), $this->__('Your Company Name'), 'UTF-8');
$this->setFont('Arial', '', 7);
$this->drawText($this->_left, $this->getY() - 10, 'Address Line 1', 'UTF-8');
$this->drawText($this->_left, $this->getY() - 25, 'City, State ZIP Code', 'UTF-8');
  1. Change the Order Pdf File Path

To ensure that your custom Invoice.php file is used instead of the core one, you need to update the app\code\core\Mage\Sales\Model\Order\Pdf.php file:

Find this line: $this->_types = array('invoice' => ...);

Change it to:

$this->_types = array(
    'invoice'             =>  new Mage_Sales_Model_Order_Pdf_Invoice,
);

The Final Result

After implementing these changes, every page of your Magento invoice PDF will now include your company logo and address information. This ensures a consistent look across all pages.

Remember that customizing core files should be done with caution. Always use a child theme or module to override files in order to maintain upgrade compatibility.

Don’t hesitate to contact our team at Laravel Company for professional Magento development services if you need further assistance.

Conclusion

While Magento provides extensive customization options, sometimes we need to dig deeper into the core code to achieve specific design goals. By following this guide, you can now create multi-page invoices with consistent header information across all pages.

This solution ensures a polished and professional look for your invoice PDFs while keeping your branding consistent throughout the customer’s interaction with your store.

Admin Orders Customers Errors

Our network