Skip to content
Brian Sweeney edited this page Feb 27, 2024 · 13 revisions

Requirements

  • PHP 7.1+ (required)
  • DOM extension (required, enabled by default)
  • MBString extension. MBString is required for Unicode support.
  • read/write access to the directories specified by \Dompdf\Options::$tempDir, \Dompdf\Options::$fontDir, and \Dompdf\Options::$fontCache by the process running dompdf (typically your web server)

Note that some of the required dependencies may have further dependencies (notably php-svg-lib requires sabberworm/php-css-parser).

Optional Dependencies

The following dependencies can add support for additional functionality or enhance existing functionality.

  • GD extension: required for rendering image types other than JPEG. JPEG images can be placed into the rendered PDF as-is. Other image types require additional processing to support transparency and other features.
    • GD is also required when background images are used since those go through additional processing to size the image.
    • Additionally either the IMagick or GMagick PHP extension can be installed to improve image processing performance for certain images. These extensions do not replace GD but are used to compliment specific functionality.
  • OPcache (OPcache, XCache, APC, etc.): improves the overall performance of PHP code execution.

Optional Configuration

  • allow_url_fopen set to true if you need to access "remote" files (that would be file references using a URL with protocol and domain, e.g. http://example.com/image.png); this is sometimes disabled by hosting providers.

External libraries used by dompdf

  • PDF Rendering
    • CPDF (included with dompdf)
    • PDFLib (optional alternative to CPDF, requires license)
    • GD (optional alternative to CPDF)
  • Font handling, if using fonts other than the core PDF fonts (courier, helvetica, times)
  • Document parsing
  • SVG rendering

Note: These libraries are included in the packaged release download.