mPDF Tutorial
mPDF is a PHP library which is used to generate PDF files from UTF-8 encoded HTML.
It is based on FPDF and HTML2PDF with a number of enhancements.
The original author, Ian Back, wrote mPDF to output PDF files ‘on-the-fly’ from his website, handling different languages. It is slower than the original scripts e.g. HTML2FPDF and produces larger files when using Unicode fonts.
It supports CSS styles etc.
mPDF has lots of features like:
- Accepts UTF-8 encoded HTML
- Supports almost all languages including RTL (arabic and hebrew), and CJK - (chinese-japanese-korean)
- Bookmarks
- CSS stylesheets
- Word spacing and character spacing for justification
- Nested block-level elements (e.g. P, DIV) including margins, borders, padding, line-height, background colours etc.
- Support (partial) for floating and fixed-position block-elements
- Page layout and orientation
- Text-justification and hyphenation
- Page numbering
- Odd and even paging with mirrored margins
- Page headers & footers
- Columns
- Tables - nested tables, rotated, or auto sized to fit on a page
- Table of contents
- Index
- Watermarks (with customizable text angle)
- Images in JPG, GIF, PNG, SVG, BMP or WMF format
- Password protection
- Annotations
- Barcodes (EAN13, UPC-A/E, Code 11, 39, 93, 128, Codabar, MSI, IMB, Planet, Postnet, RM4SCC etc.)
- Import another PDF file and use as a template
- Embedded font subsets
- PDF/A-1b support (ISO 19005-1:2005)
- PDF/X-1a support
- PDF/A-3 support (along with ZUGFeRD invoices compatibility)