Examples
NOTE: Many of the examples use non-English text to demonstrate the functions of mPDF. I have borrowed the text from various sources (Pangrams from Wikipedia, a Lorem-Ipsum generator, and some foreign News websites). As I do not speak any languages other than English and a little French, I have no idea what this text means. If there is anything that offends, or is inappropriate in any way, please let me know and I will change it.
Below are some example files prepared earlier i.e. PDF files ready to view. These are faster to download if you are just browsing. Alternatively these are the Example files included with the latest version.
This PDF file demonstrates some of the new features of version 4.2
This PDF file demonstrates some of the new features in version 4.0
This PDF file demonstrates some of the new features in version 3.0
Basic HTML (8kB)
HTML code demonstrating all the tags without a CSS stylesheet
Basic Stylesheet (4kB)
Simple example of using a stylesheet with HTML
Headers & Footers (8kB)
Headers and footers used on facing pages
HTML Headers & Footers (41kB)
HTML coded headers and footers
Paging using HTML tags (42kB)
Example using HTML (custom) tags to control various aspects of paging.
Paged media using CSS (43kB)
Example using CSS @page to control paging including crop-marks etc.
Page Orientation (56kB)
Example showing page orientation changed within the document .
Page Orientation 2 (63kB)
Example of page orientation changes keeping a fixed (portrait) HTML Header throughout.
CJK languages (28kB)
Document containing Japanese, Chinese and Korean characters (requires the Adobe Asian Font pack), also showing use of default Adobe fonts: win-1252, symbol & zapfdingbat characters. NB also bookmarks and meta-data in CJK characters.
RTL languages (1.0MB)
Right-to-Left script (Arabic and Hebrew text) with automatic alignment of text, tables, lists, cloumns, paging, headers/footers. NB also bookmarks, watermark and meta-data shows as RTL.
UTF-8 multilingual (1.8MB)
Document containing text from many different languages, including eastern european, baltic, russian, arabic, hebrew, vietnamese, thai, and some Indic languages. Specific fonts have been specified for some paragraphs for optimum results. NB bookmarks and meta-data in multiple languages.
UTF-8/CJK (1.86MB)
Same as above, with the addition of Japanese, Chinese and Korean characters in the same document (requires the Adobe Asian Font pack).
Russian using win-1251 (32kB)
Small file showing Russian text (but does not cope with Polish characters). Small file by using subset font file containing only characters in win-1251 codepage.
Russian using utf8 (295kB)
Same HTML code as above, but using UTF-8/Unicode mode. This will show all characters, but results in much larger file (due to embedded font file size).
Character Substitution (168kB)
Example of document set to use iso-8859-7 (Greek) character set. You would expect this to only show characters within this codepage correctly, except that mPDF can substitute the characters available in the default Adobe Reader fonts, Symbol, Zapfdingbats and Helvetica (win-1252). This utility is set to be ON by default in mPDF, but in this document it is turned off for the second half (using the function setSubstitutions().)
Note carefully the appearance of the Icelandic text for example, and see what happens when it is repeated in the second half of the document.
Sample html (8kB)
Just to demonstrate some varied examples of HTML tags and CSS stylesheets.
Sample html2 (18kB)
Demonstrating DIV borders, margins and padding; in-line (span) styles; styles within tables; indented paragraphs and hanging indents; outline text.
Blocks (core fonts) (28kB)
Demonstrating nested blocks and other examples. Uses the default Adobe fonts; note the small file size.
Blocks (win-1252) (361kB)
Same as above, but using embedded font files (several of them, for different font faces and styles etc.).
Blocks (utf-8) (1.96MB)
Same as above, but using embedded Unicode fonts - note file size!
Invalid XHTML - optional HTML end tags (27kB)
Same as above, except the HTML code omits end tags where they are defined as optional in the HTML 4 specification e.g. P LI etc. Although mPDF handles properly formed XHTML code ideally, it should cope with this. (see the source code)
Tables (18kB)
Examples of tables showing use of CSS styling of text within cells, cell padding and borders, autosizing, rotation etc.
Tables - nested (41kB)
Examples of nested tables.
Tables - borders (312kB)
Examples of border styles in tables.
Forms (37kB)
Examples of Form elements - select, input, textarea, checkboxes, radio, and buttons. Also demonstrates 2-column setup.
Forms RTL (588kB)
Examples of Form elements using RTL text.
Annotations (8kB)
Example of a PDF file with Annotations added.
Justify text/Word spacing (7kB)
Document showing text-justification, word-wrapping, and character/word spacing: includes justification within a table, mixed styles/font-sizes in the text, non-breaking spaces (nbsp;), correct word-wrapping avoiding 'orphans' at the end of lines
Columns (50kB)
Document using columns, turned on and off in the middle of pages - supports images, hyperlinks, bookmarks; control over height justification (vertical alignment). Note that block-level borders (DIV, P) are automatically disabled in columns.
Images (37kB)
In-line images are supported, as well as vertical alignment of text on the same line. Images in tables are supported.
Images/Tables (33kB)
This shows images in a table which is rotated by 90 degrees.
Index (56kB)
Document with an Index generated at the end. Random words are marked in the text by a custom HTML tag <INDEXENTRY>
Index RTL (1.0MB)
Document with an Index is generated using RTL (right-to-left) script.
Table of Contents - ToC (37kB)
Document with a Table of Contents generated at the start of the document. All headings are marked in the text by an additional custom HTML tag <TOCENTRY>. In this example Bookmarks are also defined for the same headings.
ToC RTL (625kB)
Document with a Table of Contents generated using RTL (right-to-left) script.
Lists (8kB)
Examples of CSS styles used in Lists.
EAN Barcode (17kB)
Example of EAN barcode - the sort you use for Books/printed publications.
Thumbnails (165kB)
Example creating thumbnails of a source PDF file.