Php2Pdf is a pure-PHP library for precision PDF layout: embedded fonts, templates from PDF, AI
and SVG, images, and text and tables that flow through chained boxes across pages. It needs
PHP 8.3 or later with ext-zlib and ext-mbstring, and nothing else at runtime.
| Guide | What it covers |
|---|---|
| Getting started | Installation, a first document, units, coordinate origins, validating output |
| Coming from PDFlib | PDFlib functions and options and their Php2Pdf equivalents |
| Documents and pages | Document, DocumentOptions, pages, page boxes, metadata, output targets, determinism, streaming |
| Canvas and colour | Paths, transforms, graphics state, clipping, colour spaces, spot colours, gradients, opacity, blend modes |
| Fonts and text | The font registry, families and metrics, drawing text, fitTextline() |
| Images | JPEG, JPEG 2000, PNG and TIFF natively, other formats through ext-imagick or ext-gd, resolution, orientation, clipping paths, transparency |
| The fit engine | Fit methods, positions, rotation and scale, what Placement tells you |
| Templates and PDF import | Reusable artwork, importing pages from PDF and AI files, the read API |
| SVG | The native converter, what it supports, the rsvg-convert adapter |
| Textflow | Styles, markup, the builder, box chaining, results and queries, copy fitting, hyphenation |
| Tables | Columns, rows, cells, styles, spans, header rows, groups, splitting, Document::flow() |
| Links, bookmarks and PDF/X-4 | Link annotations, destinations, the outline, print production output |
| Cookbook | An invoice ported from PDFlib, a two-column brochure, a report with a repeating table |
| Limitations | What is not supported, and what to expect at the edges |
| Development | Code style with Mago, running the tests, visual baselines |