dompdf is an HTML to PDF converter. At its heart, dompdf is (mostly) a CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer, it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes. PDF rendering is currently provided either by PDFLib or by a bundled version the R&OS CPDF class written by Wayne Munro. (Some important changes have been made to the R&OS class, however). In order to use PDFLib with dompdf, the PDFLib PECL extension is required. Using PDFLib improves performance and reduces the memory requirements of dompdf somewhat, while the R&OS CPDF class, though slightly slower, eliminates any dependencies on external PDF libraries.
Features
- Handles most CSS 2.1 and a few CSS3 properties, including import, media and page rules
- Supports most presentational HTML 4.0 attributes
- Supports external stylesheets, either local or through http/ftp (via fopen-wrappers)
- Supports complex tables, including row & column spans, separate & collapsed border models, individual cell styling
- Image support (gif, png (8, 24 and 32 bit with alpha channel), bmp & jpeg)
- No dependencies on external PDF libraries, thanks to the R&OS PDF class
- Inline PHP support and basic SVG support