How to Add Header and Footer to Magento 2 Invoice PDF

As a Magento 2 store owner, you surely know that you always have to send invoices to your customers with every order you deliver. Sending out authoritative transactional documents is crucial for both yours and your customers’ accounting and tax objectives.

Another important thing is how is your invoice designed. Earlier, I had shown how to make changes in the default invoice with the method to override a method of abstract file of Magento 2 invoice PDF. It is necessary that you refer that post prior to implementing the below solution.

Having a well-designed invoice pays off. Today, I’ll show how to add header and footer to Magento 2 invoice PDF programmatically.  Headers and footers carry the important company information to give order documents a more professional look. Showcase your brand name and logo, add the company details and improve the brand engagement with existing customers!

A makeover for the default Magento 2 invoice PDF with informative header and footer is just going to be easy with the below solution!

Add the function _drawFooter() in the class – Vendor\Module\Model\Rewrite\Order\Pdf\Invoice

Method to Add Header and Footer to Magento 2 Invoice PDF:

In this class, you have to override insertOrder() method and replace the following code:
That’s it! The above example is to add the logo and address in the footer. You can customize the code as per the business requirement and send invoices as the specimen shown here:

Header and Footer to Magento 2 Invoice PDF - Meetanshi

Feel free to ask any doubts in the Comments section below. I’d be happy to help.

I’d be very grateful if you helped share this helpful post on social media to fellow developers!



(based on 15 Reviews)
How to Add Header and Footer to Magento 2 Invoice PDFAuthor Magento Badge

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.


Leave a Reply

Your email address will not be published. Required fields are marked *