Navigate:
All Reposdompdf
~$DOMPDF0.1%

dompdf: HTML to PDF converter for PHP

CSS 2.1 compliant HTML layout and rendering engine.

LIVE RANKINGS • 06:51 AM • STEADY
OVERALL
#205
38
BACKEND & APIS
#10
3
30 DAY RANKING TREND
ovr#205
·Backe#10
STARS
11.0K
FORKS
1.8K
DOWNLOADS
7D STARS
+6
7D FORKS
+1
See Repo:
Share:

Learn more about dompdf

dompdf is a PHP library that implements an HTML layout and rendering engine capable of converting HTML and CSS to PDF documents. It parses CSS 2.1 and some CSS3 properties, handles complex table layouts, and embeds fonts and images directly into the generated PDF. The library uses the R&OS PDF class internally, eliminating dependencies on external PDF generation tools. Common use cases include generating invoices, reports, and documents from web content in server-side PHP applications.


1

CSS-Driven PDF Rendering

Converts HTML to PDF using standard CSS 2.1 properties and select CSS3 features. Style documents with external stylesheets, inline styles, or element attributes—no proprietary markup or PDF-specific syntax required.

2

Embedded Font Support

Includes DejaVu fonts for Unicode coverage and supports custom TrueType font embedding. Handles multilingual content and special characters beyond standard PDF fonts limited to Windows ANSI encoding.

3

Zero External Dependencies

Runs entirely within PHP without requiring external binaries like wkhtmltopdf or PhantomJS. This pure PHP implementation simplifies deployment across hosting environments and eliminates compatibility issues with system libraries or server configurations.


<?php
require_once 'vendor/autoload.php';

use Dompdf\Dompdf;

$dompdf = new Dompdf();
$dompdf->loadHtml('<h1>Invoice #12345</h1><p>Total: $499.99</p>');
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream('invoice.pdf');


vv3.1.4

Patch release fixing data URI parsing in stylesheets and base stylesheet retrieval when file_get_contents is called before rendering.

  • Update if you embed data URIs in CSS or encounter stylesheet parsing errors after upgrade to v3.1.x.
  • Apply this fix if file_get_contents usage before render() causes missing base styles in your documents.
vv3.1.3

Patch release fixes timing of fixed-position element insertion to occur before page reflow callbacks.

  • Update if you rely on page reflow callbacks, as fixed-position elements now render earlier in the layout cycle.
  • No breaking changes or new requirements are documented in the release notes.
vv3.1.2

Patches a font selection regression introduced in v3.1.1; no breaking changes or new requirements.

  • Upgrade from v3.1.1 to resolve font selection logic errors that may cause incorrect font rendering.
  • Release notes do not specify the exact nature of the font selection bug or affected font families.


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers