mPDF Manual – What Else Can I Do

Writing non-HTML text

mPDF is optimised to output HTML code, i.e. parsing the HTML markup. If you want to create a PDF file from a long text file (e.g. a PHP script file) preserving TABs and multiple spaces, use the function preparePreText(). Note this is not part of the mPDF class.

This will surround the text with <pre> tags whilst preventing any <pre> tags included in the text from being parsed. It also allows use of a text string marker ($formfeed) to be replaced by a formfeed in the output file.

See