Multiple pages, Header and Footer in PDF invoice template

I modified the mpdf_helper.php and the default template to include header and footer in the PDF.
My template add multiple pages support.
I heavily edited the default PDF invoice template.
In the header there are the logo and the company info (user_name, address, etc…)
The footer includes sub_total, item_tax_total and invoice_balance and some custom fields.
I think this improves the flexibility of the overall templating feature, as long as a more robust design consistency (the totals are always displayed at the bottom of the invoice).
Kovah, how can I help and share my template with you so you can evaluate if to add in future release?

1 Like

Just upload it somewhere and post the link here. I’ll take a look then. :blush:

this is the mpdf_helper:

this is the template:

What is in the template:

  • the header and footer html code are embedded in two global variables used from the mpdf_helper
  • added custom field “registered office”, that is different from company office address
  • added custom fields bank_name, bank_account_owner, bank_iban (weird they are not available as standard fields) and put this fields in block defore invoice items. In this block a translation record is needed for the words “Wire Information”
  • change some css rules to better fit the overall design

What is missing in the software (used some custom fields in the template to fix this lack:

  • bank details (we want to be paid by customers, right? :smile:)
  • payments terms (15 days invoice date, 30 days invoice date, Cash In Advance, and so on…)
  • registered address
  • Notes to be added at the end of items list

I made this template upon my own needs. In order to use for other people, you will need to add more checks, custom fields and change them in the code.



I would like to see that on the core!

1 Like

–Will be integrated into 1.3.0–

Development Reference: IP-189


@Kovah the link is wrong, the right one is this: IP-189

1 Like

Hi there, I just wanted to work on this but the second link leads to an empty code page. Could you upload the code again?

here it is back:

You will find some wired untranslated words in italian (it fits my need for now).
Hope this template will help you.

Just realised the first link points not to code only to a one liner of random characters, can you please bring it back on? Just want to build the same and it is still not in 1.4.3

Even I would like to replicate it but there’s no code in the links.

I guess is not very reliable…

Hi there,

I was trying to do the same (adding footer with invoice/quote page numbers / total pages).

Does anyone have a working link to the code ressource ?


Same problem here. How do I add the page number to my custom pdf invoice template?

Ok just found it out myself:
Go to settings → Invoices → At the bottom of the page add the variable {PAGENO} to PDF Footer.

Or add “Page {PAGENO} of {nb}”
to show the current page and the total amount of pages.
I think this should be a default value of that field.