How can I use a page header or footer in an invoice?

When using the mPDF Writer, you can use some special markup to define your page headers and footers.

Place your footer inside a special <htmlpagefooter> wrapper, for example:

<htmlpagefooter name="MyFooter1">
    <p>This is my page footer.</p>
</htmlpagefooter>

Also, add the following to activate the footer:

<sethtmlpagefooter name="MyFooter1" value="on" />

You'll need to call that on each page of the PDF. If you're not sure how many pages will be in the PDF, you can call it multiple times. For example, place it both above the items table and towards the end of your invoice template to ensure it shows up on the first and last pages.

Make sure the name on <sethtmlpagefooter> matches the name on the <htmlpagefooter> element.

For headers, replace footer with header. 

Learn more about this functionality in the mPDF documentation.

Still need help? Send us an email Send us an email