Dompdf is a PHP Library to convert HTML pages to PDF
dompdf is a PHP-based HTML to PDF converter that is mostly CSS 2.1 compliant. It supports external stylesheets, inline styles, and presentational HTML attributes. PDF rendering can be done using PDFLib or the bundled R&OS CPDF class.
PDFLib improves performance and reduces memory requirements, while the R&OS CPDF class eliminates 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
- Basic SVG support (see "Limitations" below)
Requirements
- PHP version 7.1 or higher
- DOM extension
- MBString extension
- php-font-lib
- php-svg-lib
Install
You can install ot using Composer:
composer require dompdf/dompdf
License
GNU Library or Lesser General Public License version 3.0 (LGPLv3)