mPDF Manual – HTML support

Custom HTML Tags

mPDF uses a number of custom HTML tags (see HTML Control Tags - Overview).

In addition to those, the custom tags <ttz> <tts> and <tta> are reserved for use internally within the mPDF program to denote the core symbol, dingbat and arial characters.

Invalid HTML?

(mPDF >= 2.2)

If you want to hide mPDF custom tags from a browser, enclose any mPDF code within:

<!--mpdf  ..  anything you want to write ...  mpdf-->

As these are the standard comment tags recognised by every browser, this will create valid HTML which should output correctly in any circumstances. mPDF will strip away the $<!–mpdf tag and any following spaces, and the $mpdf–> tag and any preceeding spaces, and process all enclosed code.

Most browsers will ignore (self-closing) tags that are not recognised, but <htmlpageheader> and <htmlpagefooter> are different, as they contain innerHTML e.g.

<htmlpageheader name="phname">HTML code in here</htmlpageheader>

The enclosed innerHTML will be output by a browser, so you need to hide it; either use the special comment tags as above, or an alternative is to use CSS, e.g. add to your stylesheet

htmlpageheader { display : none; }

htmlpagefooter { display : none; }

Yet another way is to use in-line CSS:

<htmlpageheader name="phname" style="display: none;">HTML code in here</htmlpageheader>