This uses RUNTIME HTML headers & footers. This is the simplest & quickest way to program a header/footer once for the whole document that includes images or uses more complex layout styles.
Use SetHTMLHeader() and/or SetHTMLFooter() to set HTML headers/footers before writing to the document.
This is where RUNTIME headers/footers get much more clumsy to use. When a new page is added to the document (e.g. using AddPage() or <pagebreak>) mPDF does the following:
- writes the footer for the current page
- starts the new page
- writes the header for the new page
Therefore to use any RUNTIME method you need to:
- change the header before the page-break
- change the footer after the page-break
Table of Contents
Using RUNTIME headers/footers with a Table of Contents is very clumsy, it is strongly recommended that you use one of the NAMED methods. Here for the record is how you would do it:
…and for historical reference, using depracated TOC function: