Dompdf Creator & Producer

Understanding PDF metadata that shows Dompdf as the Creator or Producer — learn how this popular PHP library converts HTML and CSS content into PDF documents.

🆓 Open Source (LGPL) 🌐 HTML to PDF 🐘 PHP Library

📄 About This PDF Metadata

When you examine a PDF file's properties and see dompdf [version] + CPDF as the Producer, it indicates that the document was generated using Dompdf — a PHP library that converts HTML and CSS to PDF format. The "CPDF" suffix refers to the bundled PDF rendering class.

Sample PDF Metadata from Dompdf:

Title: Invoice #12345

Author: Acme Corporation

Creator: Invoice Management System

Producer: dompdf 3.0.0 + CPDF

Creation Date: 2025-01-27 10:30:00

PDF Version: 1.3

Dompdf automatically sets the Producer field to show the library version and the PDF backend (CPDF or PDFLib). You can customize the Creator and other metadata fields using the add_info() method after rendering.

PDF Creator

Set with add_info('Creator', 'value') — shows the application name that generated the PDF document.

PDF Producer

Automatically set to dompdf [version] + CPDF — identifies Dompdf and the PDF rendering backend.

📚 What is Dompdf?

Dompdf is a PHP library that converts HTML and CSS to PDF documents. At its core, it's a CSS 2.1 compliant HTML layout and rendering engine written in PHP. Dompdf is a style-driven renderer that reads external stylesheets, inline style tags, and the style attributes of individual HTML elements. Development began around 2004-2005, and it was entered in the Zend PHP 5 Contest where it placed 20th overall.

Library Information

Maintainer:Brian Sweeney & Community
Development Started:~2004-2005
Current Version:3.0.x (2024)
Website:dompdf.github.io
GitHub:dompdf/dompdf

Technical Details

License:LGPL
Language:PHP
PHP Version:7.1+ (v2.x), 8.0+ (v3.x)
PDF Backend:CPDF (bundled) or PDFLib
Composer:dompdf/dompdf

Why Dompdf?

🌐

HTML/CSS to PDF

Convert existing HTML layouts directly to PDF without redesign

📦

No External Dependencies

Bundled CPDF class eliminates need for external PDF libraries

🎨

CSS 2.1 Compliant

Supports most CSS 2.1 properties plus some CSS3 features

💡 PDF Rendering Backends

Dompdf supports two PDF backends: CPDF (bundled, no dependencies) and PDFLib (requires PECL extension, better performance). Most users use CPDF as it requires no additional installation.

⚙️ How Dompdf Creates PDFs

Dompdf converts HTML/CSS to PDF through a multi-step rendering process:

PDF Generation Workflow:

1

Load HTML

loadHtml()

2

Parse CSS

External & inline styles

3

Render

render()

4

Output

stream() or output()

Dompdf Processing Steps:

  1. HTML Parsing: Parses the HTML document (optionally using HTML5 parser)
  2. CSS Resolution: Downloads and processes external stylesheets, inline styles, and element attributes
  3. Layout Engine: Calculates box model, positioning, and page breaks
  4. Font Handling: Embeds fonts (TrueType supported via php-font-lib)
  5. Image Processing: Handles JPEG, PNG, GIF, BMP, and SVG images
  6. PDF Generation: Outputs final PDF using CPDF or PDFLib backend

✨ Key Features

📝 CSS Support

  • Most CSS 2.1 properties
  • Some CSS3 properties
  • @import, @media, @page rules
  • External stylesheets (local & remote)
  • Inline styles and style attributes

📊 Tables

  • Complex table layouts
  • Row and column spans
  • Separate & collapsed border models
  • Individual cell styling
  • Nested tables

🖼️ Images

  • JPEG, PNG (8/24/32-bit with alpha)
  • GIF, BMP formats
  • SVG images (via php-svg-lib)
  • Remote images (when enabled)
  • Base64 encoded images

🔤 Fonts

  • Core PDF fonts (Helvetica, Times, Courier)
  • TrueType font embedding
  • DejaVu fonts bundled (Unicode)
  • @font-face support
  • Font subsetting

⚠️ Limitations

Dompdf doesn't support JavaScript, Flexbox, CSS Grid, or complex floats. Table cells are not pageable (must fit on one page). For best results, use simple table-based layouts with CSS 2.1 properties.

📤 How to Use Dompdf

Dompdf is easy to install via Composer:

Installation:

# Using Composer (recommended)

composer require dompdf/dompdf

# Or download packaged release from GitHub

# https://github.com/dompdf/dompdf/releases

Basic Example:

<?php

require 'vendor/autoload.php';

 

use Dompdf\Dompdf;

use Dompdf\Options;

 

// Configure options

$options = new Options();

$options->set('isRemoteEnabled', true);

$options->set('isHtml5ParserEnabled', true);

 

// Create Dompdf instance

$dompdf = new Dompdf($options);

 

// Load HTML content

$html = '<h1>Hello World</h1><p>Generated by Dompdf</p>';

$dompdf->loadHtml($html);

 

// Set paper size and orientation

$dompdf->setPaper('A4', 'portrait');

 

// Render the HTML as PDF

$dompdf->render();

 

// Output to browser

$dompdf->stream('document.pdf');

?>

Setting Metadata:

// After calling render(), add metadata

$dompdf->render();

 

// Add document information

$dompdf->add_info('Title', 'Invoice #12345');

$dompdf->add_info('Author', 'Acme Corporation');

$dompdf->add_info('Subject', 'Monthly Invoice');

$dompdf->add_info('Creator', 'Invoice System v2.0');

$dompdf->add_info('Keywords', 'invoice, billing, payment');

 

// Output options

$dompdf->stream('invoice.pdf'); // Download

$dompdf->stream('invoice.pdf', ['Attachment' => false]); // View in browser

$pdf = $dompdf->output(); // Get as string

file_put_contents('invoice.pdf', $pdf); // Save to file

🔍 Understanding PDF Metadata

Dompdf allows you to set PDF metadata using the add_info() method:

Metadata Field How to Set Description Default Value
Title add_info('Title', 'value') Document title Empty
Author add_info('Author', 'value') Document author Empty
Subject add_info('Subject', 'value') Document subject Empty
Keywords add_info('Keywords', 'value') Searchable keywords Empty
Creator add_info('Creator', 'value') Application that created the document Empty
Producer Automatic Library that produced the PDF dompdf [version] + CPDF
Creation Date Automatic When the document was created Current timestamp
Mod Date Automatic When the document was modified Current timestamp

⚠️ Important: Call add_info() After render()

Metadata must be added after calling render() but before stream() or output(). Adding metadata before rendering will have no effect.

Sample Producer Values:

Dompdf Version Producer Value
Dompdf 3.0.0dompdf 3.0.0 + CPDF
Dompdf 2.0.8dompdf 2.0.8 + CPDF
Dompdf 2.0.3dompdf 2.0.3 + CPDF
Dompdf 1.2.2dompdf 1.2.2 + CPDF
Dompdf 1.1.1dompdf 1.1.1 + CPDF
With PDFLib backenddompdf [version] (PDFLib)

🛠️ Troubleshooting

Common issues when using Dompdf:

Remote Images/CSS Not Loading

Cause: Remote resources are disabled by default for security reasons.

Solution: Enable remote resources: $options->set('isRemoteEnabled', true);. Also ensure PHP has the curl extension enabled for HTTPS resources. For local files, ensure they're within the allowed chroot directory.

HTML Not Rendering Correctly

Cause: Dompdf is not tolerant of malformed HTML.

Solution: Enable the HTML5 parser: $options->set('isHtml5ParserEnabled', true);. Alternatively, run your HTML through Tidy or the W3C Markup Validation Service before processing. Use well-formed XHTML for best results.

CSS Styles Not Applied

Cause: Dompdf only supports CSS 2.1 (and some CSS3). Modern CSS like Flexbox and Grid are not supported.

Solution: Use table-based layouts, floats, and positioning instead of Flexbox/Grid. Use inline styles for critical formatting. Check the Dompdf CSS compatibility documentation for supported properties.

Unicode Characters Not Displaying

Cause: Core PDF fonts only support Windows ANSI encoding.

Solution: Use a Unicode-enabled font like DejaVu Sans (bundled): body { font-family: DejaVu Sans; }. For custom fonts, add TrueType fonts via the font loading mechanism. Ensure your HTML is UTF-8 encoded.

Memory Exhausted Error

Cause: Large documents or complex layouts consume significant memory.

Solution: Increase PHP memory limit: ini_set('memory_limit', '256M');. Enable OPcache for better performance. Split large documents into smaller chunks. Optimize images before embedding (reduce resolution/size).

❓ Frequently Asked Questions

When a PDF shows "dompdf [version] + CPDF" as the Producer, it means the PDF was generated using Dompdf, a PHP library that converts HTML/CSS to PDF. The "CPDF" suffix indicates it's using the bundled CPDF class (based on R&OS PDF class by Wayne Munro) for the actual PDF rendering. This is the default backend that requires no additional installations.

Yes, Dompdf is free and open source, released under the LGPL license. You can use it in commercial projects without releasing your application's source code. It's one of the most popular PHP libraries for HTML to PDF conversion, with over 10,000 GitHub stars.

Dompdf development began around 2004-2005. It was entered in the Zend PHP 5 Contest where it placed 20th overall. The project has been continuously maintained, with version 3.0 released in 2024. It's currently maintained by Brian Sweeney and the community.

CPDF is a bundled PHP class that generates PDFs without external dependencies — it's the default and most commonly used backend. PDFLib is a commercial PDF library (with a free "lite" version) that requires installing the PDFLib PECL extension. PDFLib offers better performance and lower memory usage, but most users stick with CPDF for simplicity.

No, Dompdf does not support Flexbox, CSS Grid, or JavaScript. It's primarily CSS 2.1 compliant with some CSS3 properties. For best results, use table-based layouts, floats, and absolute/relative positioning. If you need modern CSS support, consider browser-based solutions like wkhtmltopdf or Puppeteer.

Dompdf: Best for converting existing HTML/CSS layouts to PDF. Simple API, CSS-focused. TCPDF: More feature-rich (barcodes, digital signatures), but requires building layouts programmatically. mPDF: Also HTML to PDF, better Unicode and RTL support than Dompdf, but larger footprint. Choose based on whether you need HTML conversion (Dompdf/mPDF) or programmatic PDF building (TCPDF).

The Producer field is automatically set by Dompdf and includes the version number. While you can technically override it using add_info('Producer', 'value') after rendering, the default value helps with debugging and version tracking. You can freely customize the Creator, Author, Title, Subject, and Keywords fields.

🛠️ Related Tools

Viewer

PDF Metadata Viewer

Free tool to view PDF metadata including Creator, Producer, and version information.

View PDF Metadata →
Converter

PDF Converter

Convert PDF files to Excel, Word, and other formats.

Convert PDF Files →

📝 Summary: Dompdf PDF Metadata

  • Maintainer: Brian Sweeney & Community
  • Development started: ~2004-2005
  • Producer shows dompdf + CPDF
  • License: LGPL
  • HTML/CSS to PDF converter
  • Current version: 3.0.x
  • CSS 2.1 compliant + some CSS3
  • Backends: CPDF, PDFLib
  • DejaVu fonts bundled (Unicode)
  • Metadata via add_info()