HTML-to-PDF examples

Ready-made documents to start from. Open any of them in the HTML to PDF tool to edit and save as PDF, or use the source in a PHP project with mPDF. They’re written with CSS both understand.

Invoice

A one-page invoice with a header, line items and totals, laid out with tables.

Portrait · @page size and margins · table layout · rows that never split

Formal letter

A plain business letter with the sender block on the right and generous margins.

Portrait · serif typography · @page margins

Multi-page report

A cover page, chapters that start on new pages, a KPI row and a table kept in one piece.

Portrait · page-break-before · page-break-inside: avoid · cover page

Certificate

A landscape certificate with a double border and two signature lines.

Landscape · @page landscape · fixed-height frame

Long price list

Sixty rows across pages, with the header row repeated on every page.

Portrait · thead repeats on each page · zebra rows

Multilingual notice

The same notice in six languages, including Arabic (right to left), Greek and Japanese.

Portrait · lang and dir attributes · font fallback

Why these layouts use tables

Browsers can lay out anything, but server-side converters like mPDF support a narrower set of CSS (details). Tables, floats with fixed widths and @page rules work everywhere, so these templates give the same result whether you print them from a browser or generate them in PHP.

Page breaks that behave

The report and price list examples show the three rules that matter most: page-break-before: always to start sections on a new page, page-break-inside: avoid to keep a table together, and a thead that repeats on every page. The page breaks guide explains each.