From mPDF >= 5.7, CSS styles can be used to control layout of the ToC.
At the end of the document, the ToC is generated, creating HTML code (internally) which looks like this:
The id is “0” for root/un-named ToC; otherwise it is lowercase of the name=”” used for the ToC
An example CSS stylesheet for this:
**Note:** From mPDF v 6.0 this example stylesheet for ToCs was added to the file mpdf.css which is read by default as a secondary default CSS stylesheet
For additional ToCs, these will have <toc name=”“> attribute. Use the lowercase e.g. for name=”Figures”
**Note:** If you have 2 ToCs immediately following each other, and wish to use pagenumstyle or suppress to control the following text, then you need to set those values on both of the <tocpagebreak> elements.
Automatically Generated ToC entries
You can automatically generate ToC entries from h1 - h6 tags, by setting the variable h2toc.
Only the default ToC will be used if more than 1 ToCs are defined for the document.
H1 - H6 must be written with uppercase when defining the array.
NB This will ignores calls from inside ToC e.g. if <tocpagebreak toc-prehtml=”<h3>Table of Contents</h3>” and H3 is set to auto-generate a ToC entry - these will be ignored.