dompdf /dompdf

HTML to PDF converter for PHP

★ 11,208⑂ 1,848👁 283⑃ 661● 2,797▤ 41
PHPCreated 2012-11-13dompdf.github.io/
11,208
stars
+0+1+11
1,848
forks
283
watchers
661
prs
2,797
issues
41
releases
–
discussions

README

Dompdf
======






 
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.

This document applies to the latest stable code which may not reflect the current 
release. For released code please
navigate to the appropriate tag.

 Features

  Handles most CSS 2.1 and a few CSS3 properties, including @import, @media &
   @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
  Basic SVG support (see "Limitations" below)
 
 Requirements

  PHP version 7.1 or higher
  DOM extension
  MBString extension
  php-font-lib
  php-svg-lib
  GD (for image processing)
    Additionally, the IMagick or GMagick extension improves image processing performance for certain image types
 
Note that some required dependencies may have further dependencies.

Visit the wiki for more information:
https://github.com/dompdf/dompdf/wiki/Requirements

 About Fonts & Character Encoding

PDF documents internally support the following fonts: Helvetica, Times-Roman,
Courier, Zapf-Dingbats, & Symbol. These fonts only support Windows ANSI
encoding. In order for a PDF to display characters that are not available in
Windows ANSI, you must supply an external font. Dompdf will embed any referenced
font in the PDF so long as it has been pre-loaded or is accessible to dompdf and
reference in CSS @font-face rules. See the
font overview
for more information on how to use fonts.

The DejaVu TrueType fonts have been pre-installed
to give dompdf decent Unicode character coverage by default. To use the DejaVu
fonts reference the font in your stylesheet, e.g. body { font-family: DejaVu
Sans; } (for DejaVu Sans). The following DejaVu 2.34 fonts are available:
DejaVu Sans, DejaVu Serif, and DejaVu Sans Mono.

 Easy Installation

 Install with composer

To install with Composer, simply require the
latest version of this package.

bash
composer require dompdf/dompdf


Make sure that the autoload file from Composer is loaded.

php
// somewhere early in your project's loading, require the Composer autoloader
// see: http://getcomposer.org/doc/00-intro.md
require 'vendor/autoload.php';


 Download and install

Download a packaged archive of dompdf and extract it into the 
directory where dompdf will reside

  You can download stable copies of dompdf from
   https://github.com/dompdf/dompdf/releases
  Or download a nightly (the latest, 

Snapshot: 2026-11-04T14:00:00Z · Data license Apache-2.0 · JSON