Guides
Practical, tested explanations for people who make PDFs, whether by hand in the browser or by the thousand on a server.
mPDF: HTML to PDF in PHP
18 guides to mPDF 8, the open-source PHP library that converts HTML and CSS into PDF. They start at a Composer install and go through fonts, headers, barcodes, invoices and fixing common errors.
- Install mPDF with ComposerRequirements, Composer install, the temp directory and your first PDF.
- Configuration optionsThe constructor config array: format, margins, fonts, temp directory.
- Output: show, download or saveThe four Output() destinations and when to use each.
- Supported HTMLWhich tags and attributes mPDF understands, and the table quirks.
- Supported CSSWhat the CSS engine handles, what it ignores, and the workarounds.
- Headers, footers and page numbersHTML headers and footers, {PAGENO}, {nbpg} and dates.
Topic index
Looking for one function, setting or tag, such as SetHTMLFooter(), tempDir or <pagebreak>? The A–Z index points to the guide that explains it.
HTML-to-PDF examples
Invoice, letter, report, certificate, long table and multilingual templates. Each opens in our HTML to PDF tool and works in mPDF unchanged.
Using the PDF tools
Each tool page has its own how-to and answers to common questions, from merging PDFs to making them smaller.