HTML to PDF converter for PHP

Overview

Dompdf

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

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.


Check out the demo and ask any question on StackOverflow or on the Google Groups.

Follow us on Twitter.


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

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

Recommendations

  • OPcache (OPcache, XCache, APC, etc.): improves performance
  • GD (for image processing)
  • IMagick or GMagick extension: improves image processing performance

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.

composer require dompdf/dompdf

Make sure that the autoload file from Composer is loaded.

// 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

Use the packaged release autoloader to load dompdf, libraries, and helper functions in your PHP:

// include autoloader
require_once 'dompdf/autoload.inc.php';

Note: packaged releases are named according using semantic versioning (dompdf_MAJOR-MINOR-PATCH.zip). So the 1.0.0 release would be dompdf_1-0-0.zip. This is the only download that includes the autoloader for Dompdf and all its dependencies.

Install with git

From the command line, switch to the directory where dompdf will reside and run the following commands:

git clone https://github.com/dompdf/dompdf.git
cd dompdf/lib

git clone https://github.com/PhenX/php-font-lib.git php-font-lib
cd php-font-lib
git checkout 0.5.1
cd ..

git clone https://github.com/PhenX/php-svg-lib.git php-svg-lib
cd php-svg-lib
git checkout v0.3.2
cd ..

git clone https://github.com/sabberworm/PHP-CSS-Parser.git php-css-parser
cd php-css-parser
git checkout 8.1.0

Require dompdf and it's dependencies in your PHP. For details see the autoloader in the utils project.

Quick Start

Just pass your HTML in to dompdf and stream the output:

// reference the Dompdf namespace
use Dompdf\Dompdf;

// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');

// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');

// Render the HTML as PDF
$dompdf->render();

// Output the generated PDF to Browser
$dompdf->stream();

Setting Options

Set options during dompdf instantiation:

use Dompdf\Dompdf;
use Dompdf\Options;

$options = new Options();
$options->set('defaultFont', 'Courier');
$dompdf = new Dompdf($options);

or at run time

use Dompdf\Dompdf;

$dompdf = new Dompdf();
$options = $dompdf->getOptions();
$options->setDefaultFont('Courier');
$dompdf->setOptions($options);

See Dompdf\Options for a list of available options.

Resource Reference Requirements

In order to protect potentially sensitive information Dompdf imposes restrictions on files referenced from the local file system or the web.

Files accessed through web-based protocols have the following requirements:

  • The Dompdf option "isRemoteEnabled" must be set to "true"
  • PHP must either have the curl extension enabled or the allow_url_fopen setting set to true

Files accessed through the local file system have the following requirement:

  • The file must fall within the path(s) specified for the Dompdf "chroot" option

Limitations (Known Issues)

  • Dompdf is not particularly tolerant to poorly-formed HTML input. To avoid any unexpected rendering issues you should either enable the built-in HTML5 parser at runtime ($options->setIsHtml5ParserEnabled(true);) or run your HTML through a HTML validator/cleaner (such as Tidy or the W3C Markup Validation Service).
  • Table cells are not pageable, meaning a table row must fit on a single page.
  • Elements are rendered on the active page when they are parsed.
  • Embedding "raw" SVG's (<svg><path...></svg>) isn't working yet, you need to either link to an external SVG file, or use a DataURI like this:
    $html = '<img src="data:image/svg+xml;base64,' . base64_encode($svg) . '" ...>';
    Watch https://github.com/dompdf/dompdf/issues/320 for progress

Donate button

If you find this project useful, please consider making a donation. Any funds donated will be used to help further development on this project.)

Issues
  • "A non-numeric value encountered" in PHP 7.1

    In PHP 7.1 there are a number of situations in the code where you'd get this error. I'm working through it right now to bring PHP 7.1 compatibility to dompdf (and will submit a PR when done), but I'm stumped by one thing:

    The reason why this happens is because you've got things like $max_y = $frame->get_position("y") + $margin_height; in \Dompdf\FrameDecorator\Page, where $margin_height might be "auto". If it is "auto", obviously that's not a number, and that's the reason why we're getting these errors.

    The default behaviour in PHP < 7.1 is to treat that as 0. So we could just look for situations where this happens and just manually force-convert "auto" to "0" and make the error go away.

    However, that's not the best way to deal with this, as it'll lead to incorrect calculations. If it's "auto", then $max_y needs to take that into account, no? But looking through the code, it seems that $margin_height comes from $frame->get_margin_height(), which calls $style->length_in_pt(), which returns "auto" if the value is "auto". No calculation is done.

    Would correcting this be a huge undertaking? Are the "auto" values calculated later on and I'm getting caught up in a situation where it just doesn't matter and can be ignored?

    enhancement 
    opened by BrunoDeBarros 93
  • Problem in Arabic text in dompdf

    Problem in Arabic text in dompdf

    I went to unicode discussion and googled it and looked for it in stackverflow

    I did everything you recommended from using standard meta tag with content type and charset to loading font that supports arabic

    and the result was I got arabic letters separated from each other and reversed

    so plz let me know If you have really a serious issue regarding supporting arabic text ??

    please refer to attached image capture

    font-handling 
    opened by amr87 83
  • No block-level parent found. Not good.

    No block-level parent found. Not good.

    Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'No block-level parent found. Not good.' in /var/www/web50/htdocs/system/library/dompdf/include/inline_positioner.cls.php:37

    All installaled PHP 5.0+ MBString extension DOM extension GD extension

    No Images, just external css/js

    bug 
    opened by Steinweber 71
  • Font issue

    Font issue

    My function works fine on windows to generate a pdf from a laravel view but in our debian environment we get the following error:

    production.ERROR: ErrorException: Undefined index: /var/www/application/dev/vendor/dompdf/dompdf\lib\fonts\Helvetica-Bold in /var/www/application/dev/vendor/dompdf/dompdf/src/
    Renderer/Text.php:97
    

    here is my code:

    $filepath = app_path().'/TestFiles/';
    $tempfilename = hash('sha1', Auth::user()->email)."-".hash('sha1', date(DATE_RFC2822)).'.pdf';
    
    $file = $filepath . $tempfilename;
    
    $pdf = PDF::loadView('Emails.quote', compact('quote', 'client', 'currency'));
    $pdf->save($file);
    

    My initial thought is the 3 slashes that are the wrong way in referencing the font

    font-handling documentation 
    opened by ghost 51
  • IMagick extension version check does not work as expected

    IMagick extension version check does not work as expected

    see https://github.com/avalanche123/Imagine/issues/474

    please make some defensive code which will handle that bug, Currently I have to manually hardcode that :/

    As a workaround, I am just changing:

    $imagickClonable = version_compare(phpversion('imagick'), '3.0.1rc1') > 0;

    to

    $imagickClonable = true; // version_compare(phpversion('imagick'), '3.0.1rc1') > 0;

    bug documentation image-handling 
    opened by pun-ky 43
  • Whitespace inside HTML tag breaks rendering

    Whitespace inside HTML tag breaks rendering

    It looks like adding whitespace between the HTML and HEAD tags breaks the renderer.

    To reproduce this, run the following:

    use Dompdf\Dompdf;
    
    $dompdf = new DomPDF();
    
    $dompdf->load_html(<<<HTML
    <html>
    <head>
    </head>
    <body>
    Hello world
    </body>
    </html>
    HTML
    );
    
    $dompdf->render();
    

    On my system (Arch Linux, PHP 7.1.7, DomPDF 0.8.0), I get the following exception:

    Fatal error: Uncaught Dompdf\Exception: No block-level parent found.  Not good. in <path>/dompdf/dompdf/src/Positioner/Inline.php:45
    Stack trace:
    #0 <path>/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(872): Dompdf\Positioner\Inline->position(Object(Dompdf\FrameDecorator\Text))
    #1 <path>/dompdf/dompdf/src/FrameReflower/Text.php(368): Dompdf\FrameDecorator\AbstractFrameDecorator->position()
    #2 <path>/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(893): Dompdf\FrameReflower\Text->reflow(NULL)
    #3 <path>/dompdf/dompdf/src/FrameReflower/Page.php(141): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow()
    #4 <path>/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(893): Dompdf\FrameReflower\Page->reflow(NULL)
    #5 <path>/dompdf/dompdf/src/Dompdf.php(831): Dom in <path>/dompdf/dompdf/src/Positioner/Inline.php on line 45
    

    Removing the whitespace from <html> to <head>, </head> to <body> and </body> to </html> prevents the error.

    bug 
    opened by TobiasKappe 38
  • DOMPDF not formatting PDF output properly on live server

    DOMPDF not formatting PDF output properly on live server

    I have a script that generates a pdf file using DOMPDF. Locally it generates fine the way I want it to be but online, the formatting is scattered. These are the two samples. The first is the output on localhost while the 2nd is the output on the live server well formated on localhost not well formated On both localhost and live server, I am using PHP 5.3.x. Please what could be the problem. I am using the latest version of dompdf

    enhancement 
    opened by yankitwizzy 37
  • Resize images from css background-size.

    Resize images from css background-size.

    Original author: [email protected] (March 29, 2012 17:46:41)

    Resize images from css background-size.

    Original issue: http://code.google.com/p/dompdf/issues/detail?id=457

    enhancement imported css 
    opened by PhenX 35
  • I have a big table and it's broken! in version 0.5.1

    I have a big table and it's broken! in version 0.5.1

    Original author: [email protected] (May 12, 2009 21:31:48)

    the title says all.

    Original issue: http://code.google.com/p/dompdf/issues/detail?id=10

    bug duplicate imported Priority-Medium 
    opened by PhenX 33
  • Cellmap->get_spanned_cells:

    Cellmap->get_spanned_cells: "Frame not found in cellmap" when rowspanned table spans to the next page

    Original author: [email protected] (September 03, 2009 20:30:09)

    What steps will reproduce the problem?

    1. rowpanned table that doesn't feet to one page

    What is the expected output? What do you see instead?

    If I change the font size of the cells content for the table to feed in one page, no error occurs. If it's expected to span to the next page, the error occurs.

    What version of the product are you using? On what operating system?

    The trunk version svned on Sept 03, 2009. x86_64 GNU/Linux.

    Please provide any additional information below.

    This error existed in the 0.5.1 version as well.

    Stack trace:

    #0 /home/.../dompdf/include/table_cell_renderer.cls.php(74): Cellmap-
    &gt;get_spanned_cells(Object(Table_Cell_Frame_Decorator))
    #1 /home/.../dompdf/include/renderer.cls.php(222): Table_Cell_Renderer-
    &gt;render(Object(Table_Cell_Frame_Decorator))
    #2 /home/.../dompdf/include/renderer.cls.php(110): Renderer-&gt;_render_frame
    ('table-cell', Object(Table_Cell_Frame_Decorator))
    #3 /home/.../dompdf/include/renderer.cls.php(143): Renderer-&gt;render(Object
    (Table_Cell_Frame_Decorator))
    #4 /home/.../dompdf/include/renderer.cls.php(143): Renderer-&gt;render(Object
    (Table_Row_Frame_Decorator))
    #5 /home/.../dompdf/include/renderer.cls.php(143): Renderer-&gt;render(Object
    (Table_Frame_Decorator))
    #6 /home/.../dompdf/include/renderer.cls.php(143): Renderer-&gt;render(Object
    (Block_Frame_Decorator))
    #7 /home/.../dompdf/include/page_frame_reflower.cls.php(103): Renderer-
    &gt;render(Object(Block_Frame_Decorator))
    #8 /home/.../dompdf/include/frame_decorator.cls.php(388): 
    Page_Frame_Reflower-&gt;reflow()
    #9 /home/.../dompdf/include/dompdf.cls.php(509): Frame_Decorator-&gt;reflow()
    #10 /home/.../file.php(26): DOMPDF-&gt;render()
    #11 {main}
      thrown in /home/.../dompdf/include/cellmap.cls.php on line 224
    

    Original issue: http://code.google.com/p/dompdf/issues/detail?id=61

    bug imported Priority-Medium tables 
    opened by PhenX 30
  • Take `min/max-height` into account in `get_min_max_width` for images

    Take `min/max-height` into account in `get_min_max_width` for images

    This includes a rework of the size calculations for images, so that min/max constraints are always honored. Previously, constraints were ignored in some cases to maintain aspect ratio. See the last part of the section on min/max widths in https://www.w3.org/TR/CSS21/visudet.html#min-max-widths for the spec on the matter.

    The first commit is a small change to enable rendering of zero-sized image frames. This ensures that outlines are drawn and that the image is still available as link target.

    Fixes #2738

    opened by Mellthas 1
  • Regression: max-height on image in table breaks second column

    Regression: max-height on image in table breaks second column

    I'm seeing an issue with max-height in the current master that was not present in 1.0.2 or 1.1.1. Possibly related to #2556? I'm seeing quite a few min-max width related PRs for 1.1.0 but nothing specifically about height.

    $html = '<table style="width:100%;">
    	<tbody>
    		<tr>
    			<td><img src="https://picsum.photos/768/348" style="max-height:7cm;"></td>
    			<td>Donaudampfschiffahrtsgesellschaftskapitän</div>
    			</td>
    		</tr>
    	</tbody>
    </table>';
    $options = new \Dompdf\Options( [
    	'isRemoteEnabled' => true,
    ] );
    $dompdf = new \Dompdf\Dompdf( $options );
    $dompdf->loadHtml( $html );
    $dompdf->render();
    $dompdf->stream();
    

    The result in 1.0.2 (same as 1.1.1): dompdf-max-height-issue-1 0 2 as you can see the image pushes the text away but it's flowing correctly

    result in current master (different image, same size): dompdf-max-height-issue-dev

    And for comparison, if I change max-height to height, it works as expected in the current master too: dompdf-height-no-issue-dev

    bug layout 
    opened by Spreeuw 3
  • Possibility of DomPDF becoming subscription/licensed software and having more active development?

    Possibility of DomPDF becoming subscription/licensed software and having more active development?

    Just a question for @bsweeney , I know you develop DomPDF in your free time so development isn't as quick as some people would like. Have you considered licensing it monthly or yearly? I would gladly pay for the software if it meant more active development, and I'm pretty sure other people here would too. Maybe a free personal license as well as a corporate license ($49.99/year)? I've been using Headless Chrome for 2 years and it's an absolute pain when generating highly stylized, multi-page PDFs with headers and footers. I'm going to try switching back to DomPDF to see if the major issues I was experiencing before have been fixed.

    discussion 
    opened by gavin310 3
  • Sometimes PDF corrupted, fonts not loaded

    Sometimes PDF corrupted, fonts not loaded

    Has anyone ever encountered this issue? Sometimes PDF file not generated correctly, custom fonts not loaded.

    Corrupted file: Screenshot 2022-01-05 135204 Screenshot 2022-01-05 140203

    Not corrupted file: Screenshot 2022-01-05 135237 Screenshot 2022-01-05 140256

    Font css:

        <style type="text/css">
            
            @font-face {
                font-family: montserrat;
                font-style: normal;
                font-weight: 400;
                src: url({{public_path('/fonts/montserrat-regular.ttf')}}) format("truetype");
            }
    
            @font-face {
                font-family: montserrat;
                font-style: normal;
                font-weight: 500;
                src: url({{public_path('/fonts/Montserrat-Medium.ttf')}}) format("truetype");
            }
    
            @font-face {
                font-family: montserrat;
                font-style: italic;
                font-weight: medium;
                src: url({{public_path('/fonts/Montserrat-MediumItalic.ttf')}}) format("truetype");
            }
    
            @font-face {
                font-family: montserrat;
                font-style: normal;
                font-weight: bold;
                src: url({{public_path('/fonts/montserrat-bold.ttf')}}) format("truetype");
            }
    

    Using laravel dompdf wrapper: Screenshot 2022-01-06 152713

    dompdf_font_family_cache.php:

    'montserrat' => array( 'normal' => $fontDir . '/montserrat_normal_c67dfdaffab05562f7a800044af0a939', '500' => $fontDir . '/montserrat_500_2ad7c67b646307194078d33a0ca02393', 'italic' => $fontDir . '/montserrat_italic_54087667d1ce4337e62fbb355d06d9a6', 'bold' => $fontDir . '/montserrat_bold_8949dacb9dda24884a307606af43b79e', ),

    font stored in 'public/fonts' Screenshot 2022-01-06 154846

    question 
    opened by qoszira15 4
  • imagecreatefrompng() libpng warnings

    imagecreatefrompng() libpng warnings

    From the recent fix of PHP library (https://bugs.php.net/bug.php?id=71316), there is an error exception thrown from libpng warnings. This causes the application unable to generate pdf (refer to dompdf/dompdf/lib/Cpdf.php:5612).

    Please advise how we can prevent this issue.

    opened by palazonyuanchen 5
  • Update .gitattributes

    Update .gitattributes

    null

    opened by erikn69 0
  • memory-leak when html contains tag pre <pre>

    memory-leak when html contains tag pre
    	                                    
    	                                 

    null

    question 
    opened by erlangparasu 7
  • Drop PHP support older than 7.4

    Drop PHP support older than 7.4

    Because those are EOL, and this would solve the confusion expressed in https://github.com/dompdf/php-svg-lib/pull/78#issuecomment-999455409

    opened by PowerKiKi 4
  • Discussion of string support for `page_script` method

    Discussion of string support for `page_script` method

    Support for passing a callback function to the page_script method was added in #2689. The open question is whether to drop support for passing a string (which will be evaluated via eval and needs the isPhpEnabled option to be set), and if, when to do that exactly.

    From #2689:

    Maybe for the 2.0 release we mark string values as deprecated and remove it with 3.0? I don't see much need to continue supporting it, though, since there are few situations where the user can't just pass in a callable.

    Generated logic being the exception, but in those cases the user can wrap variables.

    Maybe we could even mark string values as deprecated with the next release and remove it in 2.0 already? I can’t imagine any situation right now where only passing a string would work, but passing a callable wouldn’t. On the other hand, supporting a string for only the CPDF and PDFLib back ends as legacy feature wouldn’t be too much of a hassle, as the required code is quite minimal.

    It would be interesting to know if there are any good arguments for the string option to be supported going forward. So, if you are a strong proponent of that feature, please speak up.

    discussion 
    opened by Mellthas 1
  • Unexpectedly small images at page end with `max-height: 100%`

    Unexpectedly small images at page end with `max-height: 100%`

    From https://github.com/dompdf/dompdf/issues/2631#issuecomment-996897945 by @Nuranto:

    I'm not sure if this is linked to this issue, but there is image issues since last two releases. I have troubles with images that are reduced to a very tiny size, when displayed on the end of a page, instead of being displayed on next page. Even a page break does not solve this. See those two examples to understand :

    1/

    <html>
               <head>
    
               </head>
               <body>
               <div style="height:80%"></div>
               <div style="text-align: justify;">
               <img src="http://placekitten.com/500/375" style="max-width: 100%; max-height: 100%;">
               <img src="http://placekitten.com/500/375" style="max-width: 100%; max-height: 100%;">
               </div>
               </body>
               </html>
    

    2/

    <html>
               <head>
    
               </head>
               <body>
               <div style="height:90%"></div>
               <div style="text-align: justify;">
               <img src="http://placekitten.com/500/375" style="max-width: 100%; max-height: 100%;">
               <img src="http://placekitten.com/500/375" style="max-width: 100%; max-height: 100%;">
               </div>
               </body>
               </html>
    
    bug css layout 
    opened by Mellthas 1
Releases(v1.1.1)
  • v1.1.1(Nov 24, 2021)

    Change highlights since 1.0.2

    • Improves margin and page break handling (element boundary detection)
    • Improves containing block determination for positioned elements
    • Improves support for relative positioning
    • Improves border radius rendering, fixes support for border radius on table cells
    • Improves table rendering in relation to borders, column widths
    • Improves counter tracking, roman numeral rendering
    • Adds Support for WebP images when using the CPDF back end
    • Fixes issue with IMagick version check

    Bugs addressed since 1.1.0

    • Variable with potential string value was not correctly handled in a mathematical operation
    • A potential breaking change was introduced for installations using a custom dompdf_font_family_cache.dist.php

    The list of addressed issues can be found in the 1.1.0 and 1.1.1 release milestones. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    Dompdf 1.1.1 requires the following:

    • PHP 7.1 or greater
    • MBString
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x

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

    Additionally, the following are recommended for optimal use:

    • GD (for image processing)
    • allow_url_fopen set to true or the curl PHP extension (for retrieving stylesheets, images, etc via http)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_1-1-1.zip" for the packaged release. The download options labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
    dompdf_1-1-1.zip(3.84 MB)
  • v1.1.0(Nov 16, 2021)

    This release has been superseded by version 1.1.1

    Change highlights since 1.0.2

    • Improves margin and page break handling (element boundary detection)
    • Improves containing block determination for positioned elements
    • Improves support for relative positioning
    • Improves border radius rendering, fixes support for border radius on table cells
    • Improves table rendering in relation to borders, column widths
    • Improves counter tracking, roman numeral rendering
    • Adds Support for WebP images when using the CPDF back end
    • Fixes issue with IMagick version check

    The list of addressed issues can be found in the release milestone. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    Dompdf 1.1.0 requires the following:

    • PHP 7.1 or greater
    • MBString
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x

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

    Additionally, the following are recommended for optimal use:

    • GD (for image processing)
    • allow_url_fopen set to true or the curl PHP extension (for retrieving stylesheets, images, etc via http)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_1-1-0.zip" for the packaged release. The download options labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
    dompdf_1-1-0.zip(3.84 MB)
  • v1.0.2(Jan 8, 2021)

    This release has been superseded by version 1.1.0

    Change highlights since 0.8.6

    • Adds support for PHP 8
    • Adds support for soft hyphens
    • Adds multi-path support to the chroot option
    • Fixes table cells positioning following a rowspanned cell
    • Fixes excessive minimum widths for columns spanned by a colspanned cell
    • Addresses a performance issue related to parsing CSS image URLs

    Bugs addressed since 1.0.1

    • Multi-path chroot support was not correctly parsed

    Note on resource references: Because of the changes in resource security, some resources (images, external stylesheets) that would previously load with the default settings may no longer load. To ensure compatibility with this release ensure that remote resources can be loaded and that any local filesystem resources are within the directories specified by the chroot setting. By default, chroot is set to the Dompdf directory. Information on how to change these settings can be found in the readme section on setting options.

    The list of addressed issues can be found in the release milestone. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    Dompdf 1.0.2 requires the following:

    • PHP 7.1 or greater
    • MBString
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x

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

    Additionally, the following are recommended for optimal use:

    • GD (for image processing)
    • allow_url_fopen set to true or the curl PHP extension (for retrieving stylesheets, images, etc via http)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_1-0-2.zip" for the packaged release. The download options labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
    dompdf_1-0-2.zip(3.98 MB)
  • v1.0.1(Dec 31, 2020)

    This release has been superseded by version 1.0.2

    Change highlights since 0.8.6

    • Adds support for PHP 8
    • Adds support for soft hyphens
    • Adds multi-path support to the chroot option
    • Fixes table cells positioning following a rowspanned cell
    • Fixes excessive minimum widths for columns spanned by a colspanned cell
    • Addresses a performance issue related to parsing CSS image URLs

    Bugs addressed since 1.0.0

    • Merging some Style properties broke when using the computed value
    • Border shorthand parsing did not cause recalculation of related properties
    • Variable reference error in the Stylesheet class

    Note on resource references: Because of the changes in resource security, some resources (images, external stylesheets) that would previously load with the default settings may no longer load. To ensure compatibility with this release ensure that remote resources can be loaded and that any local filesystem resources are within the directories specified by the chroot setting. By default, chroot is set to the Dompdf directory. Information on how to change these settings can be found in the readme section on setting options.

    The list of addressed issues can be found in the release milestone. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    Dompdf 1.0.1 requires the following:

    • PHP 7.1 or greater
    • MBString
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x

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

    Additionally, the following are recommended for optimal use:

    • GD (for image processing)
    • allow_url_fopen set to true or the curl PHP extension (for retrieving stylesheets, images, etc via http)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer a packaged release will be made available shortly. The download options labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Dec 24, 2020)

    This release has been superseded by version 1.0.1

    Change highlights since 0.8.6

    • Adds support for PHP 8
    • Adds support for soft hyphens
    • Adds multi-path support to the chroot option
    • Fixes table cells positioning following a rowspanned cell
    • Fixes excessive minimum widths for columns spanned by a colspanned cell
    • Addresses a performance issue related to parsing CSS image URLs

    Note on resource references: Because of the changes in resource security, some resources (images, external stylesheets) that would previously load with the default settings may no longer load. To ensure compatibility with this release ensure that remote resources can be loaded and that any local filesystem resources are within the directories specified by the chroot setting. By default, chroot is set to the Dompdf directory. Information on how to change these settings can be found in the readme section on setting options.

    The list of addressed issues can be found in the release milestone. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    Dompdf 1.0.0 requires the following:

    • PHP 7.1 or greater
    • MBString
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x

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

    Additionally, the following are recommended for optimal use:

    • GD (for image processing)
    • allow_url_fopen set to true or the curl PHP extension (for retrieving stylesheets, images, etc via http)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer a packaged release will be made available shortly. The download options labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
  • v0.8.6(Sep 7, 2020)

    This release has been superseded by version 1.0.1

    Change highlights since 0.8.5

    • Adds support for the background-size CSS3 property
    • Adds support for loading an existing DOMDocument
    • Adds support for PDF form fields (AcroForm)
    • Adds support for digital signatures
    • Adds support for PDF file attachments
    • Bumps PDF version to 1.7 (no major structural changes)
    • Improves text width calculations
    • Addresses ImageMagick 7 compatibility
    • Addresses PDF compatibility issues related to font subsetting and encryption
    • Addresses style inheritance issues introduced with previous version
    • Linked resources now honor the resource security options (breaking change, see note below and linked issue)

    Note on resource references: Because of the changes in resource security, some resources (images, external stylesheets) that would previously load with the default settings may no longer load. To ensure compatibility with this release ensure the remote resources can be loaded and that any local filesystem resources are within the directory specified by the chroot setting. By default, chroot is set to the Dompdf directory. Information on how to change these settings can be found in the readme section on setting options.

    This update addresses the following announced vulnerabilities:

    | Vulnerability | Reference | Type | Severity | | --- | --- | --- | --- | | Information Disclosure through local image reference | Issue 2152 | Information Disclosure | Low; Critical (system-dependent) |

    The list of addressed issues can be found in the release milestone. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    Dompdf 0.8.6 requires the following:

    • PHP 7.1 or greater
    • MBString
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x

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

    Additionally, the following are recommended for optimal use:

    • GD (for image processing)
    • allow_url_fopen set to true or the curl PHP extension (for retrieving stylesheets, images, etc via http)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_0-8-6.zip" for the packaged release. The two buttons labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
    dompdf_0-8-6.zip(3.98 MB)
  • v0.8.5(Feb 21, 2020)

    This release has been superseded by version 0.8.6

    Change highlights since 0.8.4

    • Specified document encoding is now honored (previously would always use UTF8).
    • TH elements are now centered by default
    • Fixes style parsing bug that could result in values resetting to style property default
    • Fixes text width calculation that resulted in overly wide elements, namely table cells
    • Fixes bug in curl implementation

    The list of addressed issues can be found in the release milestone. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    Dompdf 0.8.5 requires the following:

    • PHP 7.1 or greater
    • MBString
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x

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

    Additionally, the following are recommended for optimal use:

    • GD (for image processing)
    • allow_url_fopen set to true or the curl PHP extension (for retrieving stylesheets, images, etc via http)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_0-8-5.zip" for the packaged release. The two buttons labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
    dompdf_0-8-5.zip(3.97 MB)
  • v0.8.4(Jan 20, 2020)

    This release has been superseded by version 0.8.5

    Change highlights since 0.8.3

    • Improves compatibility with PHP 7.x
    • Improves support for PDFLib 9
    • Adds support for numeric font weights
    • Improves style inheritance though addition of computed CSS values in addition to declared and used values
    • Improved handling of non-breaking space and word boundaries
    • Minor improvement to table border/background rendering

    The list of addressed issues can be found in the release milestone. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    Dompdf 0.8.4 requires the following:

    • PHP 7.1 or greater
    • MBString
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x

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

    Additionally, the following are recommended for optimal use:

    • GD (for image processing)
    • allow_url_fopen set to true or the curl PHP extension (for retrieving stylesheets, images, etc via http)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_0-8-4.zip" for the packaged release. The two buttons labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
    dompdf_0-8-4.zip(3.97 MB)
  • v0.8.3(Dec 18, 2018)

    This release has been superseded by version 0.8.4

    Change highlights since 0.8.2

    • Improved compatibility with PHP 7.3
    • Supported PDFLib version bumped to PDFLib 9
    • Added page_line() canvas method (like page_text())
    • Page break improvements
    • Bug Fix: word-wrap: break-word no longer expands parent containers
    • Bug Fix: Addressed decorator positioning issues due to incorrect height calculation (better underline positioning)
    • GD is now only recommended per composer configuration (though still required for image processing)

    The list of addressed issues can be found in the release milestone. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    Dompdf 0.8.3 requires the following:

    • PHP 5.4 or greater
    • MBString
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x

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

    Additionally, the following are recommended for optimal use:

    • GD (for image processing)
    • allow_url_fopen set to true or the curl PHP extension (for retrieving stylesheets, images, etc via http)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_0-8-3.zip" for the packaged release. The two buttons labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
    dompdf_0-8-3.zip(3.95 MB)
  • v0.8.2(Nov 26, 2017)

    This release has been superseded by version 0.8.3

    Change highlights since 0.8.1

    • Bug Fix: "no block level parent found" errors
    • Bug Fix: links to external resources broken
    • Bug Fix: Image rendering issues when using IMagick
    • Margin collapse logic now handles negative margins
    • Additional object type checking

    The list of addressed issues can be found in the release milestone. View all changes since the previous release in the commit history.

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    dompdf 0.8.2 requires the following:

    • PHP 5.4 or greater
    • MBString
    • GD (for image processing)
    • allow_url_fopen set to true (for retrieving stylesheets or images via http) or the curl PHP extension
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x (if rendering SVG)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_0-8-2.zip" for the packaged release. The two buttons labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
    dompdf_0-8-2.zip(3.97 MB)
  • v0.8.1(Nov 21, 2017)

    This release has been superseded by version 0.8.2

    Change highlights since 0.8.0

    • Improves compatibility with PHP 7.1
    • Improves table rendering around page breaks and margins
    • Fixes paging of generated content
    • Improves handling of CSS selectors, media queries, and inherited properties
    • Fixes Unicode support in (encrypted) PDF documents

    View all changes since the previous release in the commit history.

    Updated dependencies

    • php-svg-lib 0.5.1
    • php-svg-lib 0.3

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    dompdf 0.8.1 requires the following:

    • PHP 5.4 or greater
    • MBString
    • GD (for image processing)
    • allow_url_fopen set to true (for retrieving stylesheets or images via http) or the curl PHP extension
    • php-font-lib v0.5.x
    • php-svg-lib v0.3.x (if rendering SVG)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_0-8-1.zip" for the packaged release. The two buttons labeled "Source code" are auto-generated by github and do not include all the dependencies.

    Source code(tar.gz)
    Source code(zip)
    dompdf_0-8-1.zip(3.88 MB)
  • v0.8.0(Feb 19, 2017)

    This release has been superseded by version 0.8.1

    Change highlights since 0.7.0

    • Improves compatibility with PHP 7.1
    • Adds support for width: auto CSS styling
    • Adds support for RGB-alpha and HEX-alpha CSS color values
    • Falls back to curl for remote resource fetching
    • Adds support for HTML5 elements
    • Improves CSS support for the following: float, nth-child/nth-of-type, :matches pseudo-class
    • Adds support for in-document linking using element ID
    • Adds preliminary support for media queries (width, height, and orientation)
    • Improves performance in various areas
    • Updates DejaVu Fonts to 2.37

    Updated dependencies

    • php-font-lib 0.5
    • php-svg-lib 0.2

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    dompdf 0.7.0 requires the following:

    • PHP 5.3 or greater
    • MBString
    • GD (for image processing)
    • allow_url_fopen set to true (for retrieving stylesheets or images via http) or the curl PHP extension
    • php-font-lib v0.5.x
    • php-svg-lib v0.2 (if rendering SVG)

    For full requirements and recommendations see the requirements page on the wiki.

    Download Instructions

    The dompdf team recommends that you use Composer for easier dependency management.

    If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. Click the link labeled "dompdf_0-8-0.zip" for the packaged release. The two buttons labeled "Source code" are auto-generated by github and do not include all the necessary files.

    Source code(tar.gz)
    Source code(zip)
    dompdf_0-8-0.zip(3.83 MB)
  • v0.7.0(May 12, 2016)

    This release has been superseded by version 0.8.0

    Change highlights since 0.6.2

    • Incorporate relevant security updates from the 0.6.2 code base
    • Add namespace support
    • Restructure code for implementation of the PSR coding standard
    • Drop support for the dompdf_config.inc.php configuration file; see the migration section below for more details
    • Remove non-library utility code (load_font.php, dompdf.php, the www content)
    • Add initial support for SVG

    The majority of work in this release went towards support for namespaces, PSR, and SVG support but a few code improvements were also made. Highlights include:

    • Update DejaVu fonts to v2.34
    • Optimize performance by removing support for versions of PHP prior to 5.3
    • Improve PDF structure produced by CPDF
    • Add rendered document page selection support to the GD adapter
    • Take Unicode and float support out of "beta"
    • Add support for unit testing

    We would like to extend our gratitude to the community members who helped make this release possible.

    Requirements

    dompdf 0.7.0 requires the following:

    • PHP 5.3 or greater
    • MBString
    • GD (for image processing)
    • allow_url_fopen set to true (for retrieving stylesheets or images via http)
    • php-font-lib v0.4.x
    • php-svg-lib v0.1 (if rendering SVG)

    For full requirements and recommendations see the requirements page on the wiki.

    The dompdf team recommends that you use Composer for easier dependency management. If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. The release package is titled dompdf_0-7-0.zip.

    Notes on migrating from an earlier version of dompdf

    1. Because the dompdf_config.inc.php file has been removed from this release (and is no longer referenced) all dompdf options should be set at run time.
    2. The class naming conventions required a change to the dompdf_font_family_cache.php file. Though we have attempted to accommodate this change your first step when encountering bugs (if you don't know where to start) might be to reset your font directory (i.e. remove custom font files and the related font metrics files, and remove the non-dist, generated, font family cache file).
    3. Though a font loading script is no longer provided with dompdf you may continue to use the @font-face CSS rule to install fonts at run time. If you wish to pre-load fonts you may find a copy of the load_font.php script updated to run with this release of dompdf in the dompdf-utils project.
    4. The FontMetrics class is now instantiated instead of static. To simplify migration of embedded scripts from earlier versions of dompdf we provide access to the instantiated FontMetrics class via the $fontMetrics variable. Please update your embedded scripts. For example, FontMetrics::get_font('helvetica') would now be $fontMetrics->getFont('helvetica').
    Source code(tar.gz)
    Source code(zip)
    dompdf_0-7-0.zip(3.69 MB)
  • v0.7.0-beta3(Jan 22, 2016)

    Change highlights since 0.6.2

    • Incorporate relevant security updates from the 0.6.2 code base
    • Add namespace support
    • Restructure code for implementation of the PSR coding standard
    • Drop support for the dompdf_config.inc.php configuration file; see the migration section below for more details
    • Remove non-library utility code (load_font.php, dompdf.php, the www content)
    • Add initial support for SVG

    The majority of work in this release went towards support for namespaces, PSR, and SVG support but a few code improvements were also made. Highlights include:

    • Update DejaVu fonts to v2.34
    • Optimize performance by removing support for versions of PHP prior to 5.3
    • Improve PDF structure produced by CPDF
    • Add rendered document page selection support to the GD adapter
    • Take Unicode and float support out of "beta"
    • Add support for unit testing

    Requirements

    The dompdf 0.7.0 beta 3 requires the following:

    • PHP 5.3 or greater
    • MBString
    • GD (for image processing)
    • allow_url_fopen set to true (for retrieving stylesheets or images via http)
    • php-font-lib v0.4.x
    • php-svg-lib v0.1 (if rendering SVG)

    For full requirements and recommendations see the requirements page on the wiki.

    The dompdf team recommends that you use Composer for easier dependency management. If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. The beta package is titled dompdf_0-7-0_beta3.zip.

    Notes on migrating from an earlier version of dompdf

    1. Because the dompdf_config.inc.php file has been removed from this release (and is no longer referenced) all dompdf options will have to be set at run time. To simplify your in-code instantiation you can implement an intermediary script to instantiate dompdf and set the options, referencing this intermediate script in your project. We may provide such a script in the final release to help with migration.
    2. The class naming conventions required a change to the dompdf_font_family_cache.php file. Though we have attempted to accommodate this change your first step when encountering bugs (if you don't know where to start) might be to reset your font directory (i.e. remove custom font files, font metrics files, and the font family cache file).
    3. During the beta period the utilities for pre-loading fonts are not available. We hope to make these utilities available for the final release (in a separate project). You may continue to use the @font-face CSS rule to install fonts at run time.
    4. The FontMetrics class is now instantiated instead of static. To simplify migration we provide access to it via the $fontMetrics variable. Please update your embedded scripts. For example, FontMetrics::get_font('helvetica') would now be $fontMetrics->getFont('helvetica').
    Source code(tar.gz)
    Source code(zip)
  • v0.6.2(Dec 11, 2015)

    This release is superseded by version 0.7.0

    This is a security-focused release that addresses a number of vulnerabilities that can expose your system to exploitation. In tandem with this release we have also posted a document to the wiki with advice for securing dompdf. Please read the new document and take appropriate measures to protect your systems.

    We urge all users to upgrade to this release if you are using dompdf 0.6.1 or earlier.

    Change Summary for 0.6.2

    This update addresses the following announced vulnerabilities:

    | Vulnerability | Reference | Type | Severity | | --- | --- | --- | --- | | Remote Code Execution (complement of CVE-2014-2383) | CVE-2014-5013 | Remote Code Execution | Low; Critical (depending on configuration) | | Denial Of Service Vector | CVE-2014-5012 | Information Disclosure | Medium | | Information Disclosure | CVE-2014-5011 | Information Disclosure | Medium | | Arbitrary file read in dompdf using PHP stream filters | CVE-2014-2383 | Information Disclosure | Medium |

    Change Summary for 0.6.1

    • Removed pre-processing of PHP code when DOMPDF_ENABLE_PHP is true (this does not affect embedded script).
    • Prior to this release dompdf was vulnerable to an information disclosure vulnerability. Thanks to Portcullis Computer Security Ltd. for reporting the issue. See the security advisory for additional details: Arbitrary file read in dompdf.

    This update addresses the following announced vulnerabilities:

    | Vulnerability | Reference | Type | Severity | | --- | --- | --- | --- | | Arbitrary file read in dompdf using PHP stream filters | CVE-2014-2383 | Information Disclosure | Medium | | PHP remote file inclusion vulnerability in dompdf.php | CVE-2010-4879 | Remote File Inclusion | Low; Critical (depending on configuration) |

    Change Summary for 0.6.0

    • Fonts: Full Unicode support (with embedded fonts); DejaVu fonts pre-installed; php-font-lib now provides font handling and sub-setting
    • CSS: float support, border radius, transparency, @page, @font-face, generated content, fixed-positioning, transformations
    • HTML: HTML5 Parser cleans your HTML syntax
    • Images: Expanded image handling (including alpha transparency); added support for Data-URI image sources
    • Performance improvements
    • The project is now hosted on GitHub (the Google Code project is being temporarily maintained).

    Download Instructions

    Click the link labeled "dompdf-0.6.2.zip" to download the packaged release. The two buttons labeled "Source code" are auto-generated by github and do not include all the necessary files.

    Source code(tar.gz)
    Source code(zip)
    dompdf-0.6.2.zip(7.00 MB)
  • v0.7.0-beta2(Sep 27, 2015)

    Change highlights since 0.6.2

    • Add namespace support
    • Restructure code for implementation of the PSR coding standard
    • Drop support for the dompdf_config.inc.php configuration file; see the migration section below for more details
    • Remove non-library utility code (load_font.php, dompdf.php, the www content)
    • Add initial support for SVG

    The majority of work in this release went towards support for namespaces, PSR, and SVG support but a few code improvements were also made. Highlights include:

    • Update DejaVu fonts to v2.34
    • Optimize performance by removing support for versions of PHP prior to 5.3
    • Improve PDF structure produced by CPDF
    • Add rendered document page selection support to the GD adapter
    • Take Unicode and float support out of "beta"
    • Add support for unit testing

    Requirements

    The dompdf 0.7.0 beta 2 requires the following:

    • PHP 5.3 or greater
    • MBString
    • GD (for image processing)
    • allow_url_fopen set to true (for retrieving stylesheets or images via http)
    • php-font-lib v0.4.x
    • php-svg-lib v0.1 (if rendering SVG)

    For full requirements and recommendations see the requirements page on the wiki.

    The dompdf team recommends that you use Composer for easier dependency management. If you're not yet using Composer you can download a packaged release of dompdf which includes all the files you need to use the library. The beta package is titled dompdf_0-7-0_beta2.zip.

    Notes on migrating from an earlier version of dompdf

    1. Because the dompdf_config.inc.php file has been removed from this release (and is no longer referenced) all dompdf options will have to be set at run time. To simplify your in-code instantiation you can implement an intermediary script to instantiate dompdf and set the options, referencing this intermediate script in your project. We may provide such a script in the final release to help with migration.
    2. The class naming conventions required a change to the dompdf_font_family_cache.php file. Though we have attempted to accommodate this change your first step when encountering bugs (if you don't know where to start) might be to reset your font directory (i.e. remove custom font files, font metrics files, and the font family cache file).
    3. During the beta period the utilities for pre-loading fonts are not available. We hope to make these utilities available for the final release (in a separate project). You may continue to use the @font-face CSS rule to install fonts at run time.
    4. The FontMetrics class is now instantiated instead of static. To simplify migration we provide access to it via the $fontMetrics variable. Please update your inline scripts. For example, FontMetrics::get_font('helvetica') would now be $fontMetrics->getFont('helvetica').
    Source code(tar.gz)
    Source code(zip)
  • v0.7.0-beta(May 4, 2015)

    Change highlights since 0.6.2

    • Added namespace support
    • Restructured code for the implementation of the PSR-2 coding standard
    • Dropped support for the configuration file (dompdf_config.inc.php); see the migration section below for more details
    • Removed non-library code (load_font.php, dompdf.php, the www content)

    The majority of work in this release went towards support for namespaces and PSR-2, but a few code improvements were also made.

    • Updated DejaVu fonts to v2.34
    • Optimized performance by removing pre-5.3 code
    • Improved PDF structure produced by CPDF

    Requirements

    The dompdf 0.7.0 beta requires the following:

    • PHP 5.3 or greater
    • GD (for image processing)
    • allow_url_fopen set to true (for retrieving images via http)
    • php-font-lib v0.3.x

    For full requirements and recommendations see the requirements page on the wiki.

    The dompdf team recommends that you use Composer for easier dependency management. If you're not yet using Composer you can download an archived release of dompdf which includes all the files you need to use the library. The beta download is titled dompdf_0.7.0.beta.zip.

    Notes on migrating from an earlier version of dompdf

    1. Because the dompdf_config.inc.php file has been removed from this release (and is no longer referenced) all dompdf options will have to be set at run time. To simplify your in-code instantiation you can implement an intermediary script to instantiate dompdf and set the options, referencing this intermediate script in your project. We may provide such a script in the final release to help with migration.
    2. The class naming conventions required a change to the dompdf_font_family_cache.php file. Though we have attempted to accommodate this change your first step when encountering bugs (if you don't know where to start) might be to reset your font directory (i.e. remove custom font files, font metrics files, and the font family cache file).
    3. During the beta period the utilities for pre-loading fonts are not available. We hope to make these utilities available for the final release (in a separate project). You may continue to use the @font-face CSS rule to install fonts at run time.
    4. The FontMetrics class is now instantiated instead of static. To simplify migration we provide access to it via the $fontMetrics variable. Please update your inline scripts. For example, FontMetrics::get_font('helvetica') would now be $fontMetrics->get_font('helvetica').
    Source code(tar.gz)
    Source code(zip)
  • v0.6.1(Mar 14, 2014)

    This release is superseded by version 0.6.2

    dompdf is an HTML to PDF converter. At its heart, dompdf is (mostly) CSS2.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.

    Change highlights since 0.6.0

    • Removed pre-processing of PHP code when DOMPDF_ENABLE_PHP is true (this does not affect inline script).
    • Prior to this release dompdf was vulnerable to an information disclosure vulnerability. Thanks to Portcullis Computer Security Ltd. for reporting the issue. See the security advisory for additional details: Arbitrary file read in dompdf.

    Change highlights since 0.5.2

    • Fonts: Full Unicode support (with embedded fonts); DejaVu fonts pre-installed; php-font-lib now provides font handling and sub-setting
    • CSS: float support, border radius, transparency, @page, @font-face, generated content, fixed-positioning, transformations
    • HTML: HTML5 Parser cleans your HTML syntax
    • Images: Expanded image handling (including alpha transparency); added support for Data-URI image sources
    • Performance improvements
    • The project is now hosted on GitHub (the Google Code project is being temporarily maintained).

    Download Instructions

    The two buttons labeled "Source code" are auto-generated by github and do not include all the necessary files.

    Source code(tar.gz)
    Source code(zip)
    dompdf_0-6-1.zip(8.01 MB)
  • v0.6.0(Mar 14, 2014)

    This release is superseded by version 0.6.2

    dompdf is an HTML to PDF converter. At its heart, dompdf is (mostly) CSS2.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.

    Change highlights since 0.5.2

    • Fonts: Full Unicode support (with embedded fonts); DejaVu fonts pre-installed; php-font-lib now provides font handling and sub-setting
    • CSS: float support, border radius, transparency, @page, @font-face, generated content, fixed-positioning, transformations
    • HTML: HTML5 Parser cleans your HTML syntax
    • Images: Expanded image handling (including alpha transparency); added support for Data-URI image sources
    • Performance Improvements

    Download Instructions

    The two buttons labeled "Source code" are auto-generated by github and do not include all the necessary files.

    Source code(tar.gz)
    Source code(zip)
    dompdf_0-6-0.zip(8.01 MB)
  • v0.5.2(Aug 17, 2013)

  • v0.6.0-b3(Aug 16, 2013)

    New Features

    HTML/CSS/Images support

    • Limited support for CSS float (disabled by default). See DOMPDF_ENABLE_CSS_FLOAT (svn: r407, r408, r415, r438, r457, r459, r471)
    • Support for nth-child selectors (svn: r407, r419)
    • Support for @font-face (svn: r407, r413)
    • Font sub-setting now available (disabled by default). See DOMPDF_ENABLE_FONTSUBSETTING (svn: r466, r468, r469)
    • Added an HTML5 Parser to enable improved document parsing/correction (disabled by default). See DOMPDF_ENABLE_HTML5PARSER (svn: r429, r430, r431, r441)
    • Added support for ID in anchors tags (svn: r373)
    • Added a message for broken images and updated the broken_image.png file to something less aggressive (svn: r377)
    • Added support for transparent PNG in background-image and improved background-image handling (svn: r380, r404, r450, r453)
    • Improved absolute positioning (svn: r387, r409, r459, r460)
    • Added support for the "rem" CSS unit (svn: r389)
    • Improved support for the "ex" CSS unit (svn: r390)
    • When parsing tables, TR elements not contained by TBODY, TFOOT, or THEAD are automatically encapsulated by TBODY (svn: r390)
    • Added support for the CSS declaration word-wrap: break-word (svn: r391)
    • Added support for @page :left, :right, :first, :odd, and :even (svn: r393)
    • Added support for CSS visibility and empty-cells properties (svn: r393)
    • Type selectors (e.g. h1) are now case insensitive (svn: r417)
    • Image type detection is now based on file header instead of filename extension (svn: r422)
    • Added support for HTML5-style charset metatag (<meta charset=”utf-8”>) (svn: r430)
    • Added support for nested CSS counters (svn: r438)
    • Replaced TTF2UFM with php-font-lib and remove all dependencies on TTF2UFM (svn: r447)
    • Table columns widths are now consistent across pages (svn: r462)
    • Added limited support for table captions (svn: r456)
    • Reduced rendering time by using caches (svn: r469)

    Installation / configuration / debugging

    • Added frame (i.e. discreet document element) count to the sample website debugger output (svn: r399)
    • DOMPDF_ENABLE_REMOTE is no longer needed for stylesheet references that use a URL with domain component (svn: r407)
    • Added a ready-to-use web-based font installer to the sample website (www/fonts.php) (svn: r417, r418)
    • Added the Unicode-compatible DejaVu Fonts as part of the base installation (svn: r388)

    Major bug fixes

    • Fixes compatibility with the Symfony framework autoloader (disabled by default). See DOMPDF_AUTOLOAD_PREPEND (svn: r374)
    • Fixes errors in how margins were collapsed between siblings (svn: r375)
    • Improves the way lines are aligned vertically (see the css_baseline example) (svn: r375)
    • Corrects the bounding box used for drawing backgrounds (svn: r377)
    • Fixes the z-index rendering process (svn: r377, r378, r379, r393)
    • Adds support for color styling inheritance (svn: r390)
    • Fixes bugs with nested tables and HTML attributes (svn: r393)
    • Fixes handling of URLs with non-ascii chars in the CPDF adapter (svn: r394)
    • Fixes a rgb()-style color parsing bug (svn: r402)
    • Fixes RLE4 compressed bitmap image support (svn: r405)
    • Fixes bug that caused generated content to occasionally display multiple times (svn: r406)
    • Improves background image clipping (svn: r417)
    • Fixes table layout bug caused by zero-height rows (svn: r464)
    • Fixes layout bug caused by 100% width tables centered with margin auto (svn: r465)
    Source code(tar.gz)
    Source code(zip)
PHP library generating PDF files from UTF-8 encoded HTML

mPDF is a PHP library which generates PDF files from UTF-8 encoded HTML. It is based on FPDF and HTML2FPDF (see CREDITS), with a number of enhancement

null 3.4k Jan 11, 2022
PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage

Snappy Snappy is a PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. It uses the excellent webkit-based wkhtmltopd

KNP Labs 4k Jan 14, 2022
PHP library allowing PDF generation or snapshot from an URL or an HTML page. Wrapper for Kozea/WeasyPrint

PhpWeasyPrint PhpWeasyPrint is a PHP library allowing PDF generation from an URL or an HTML page. It's a wrapper for WeasyPrint, a smart solution help

Pontedilana 7 Jan 11, 2022
Convert HTML to PDF using Webkit (QtWebKit)

wkhtmltopdf and wkhtmltoimage wkhtmltopdf and wkhtmltoimage are command line tools to render HTML into PDF and various image formats using the QT Webk

wkhtmltopdf 11.8k Jan 20, 2022
Convert html to an image, pdf or string

Convert a webpage to an image or pdf using headless Chrome The package can convert a webpage to an image or pdf. The conversion is done behind the sce

Spatie 3.6k Jan 15, 2022
Laravel package to convert HTML to PDF, supporting multiple drivers.

eve/pdf-converter A Laravel package to help convert HTML to PDF. Supports multiple drivers. Requirements and Installation eve/pdf-converter requires L

eve.io 8 Dec 7, 2021
Convert HTML to PDF using Webkit (QtWebKit)

wkhtmltopdf and wkhtmltoimage wkhtmltopdf and wkhtmltoimage are command line tools to render HTML into PDF and various image formats using the QT Webk

wkhtmltopdf 11.8k Jan 16, 2022
Official clone of PHP library to generate PDF documents and barcodes

TCPDF PHP PDF Library Please consider supporting this project by making a donation via PayPal category Library author Nicola Asuni [email protected] co

Tecnick.com LTD 3.2k Jan 18, 2022
TCPDF - PHP PDF Library - https://tcpdf.org

tc-lib-pdf PHP PDF Library UNDER DEVELOPMENT (NOT READY) UPDATE: CURRENTLY ALL THE DEPENDENCY LIBRARIES ARE ALMOST COMPLETE BUT THE CORE LIBRARY STILL

Tecnick.com LTD 1.1k Jan 12, 2022
Pdf and graphic files generator library written in php

Information Examples Sample documents are in the "examples" directory. "index.php" file is the web interface to browse examples, "cli.php" is a consol

Piotr Śliwa 331 Jan 7, 2022
PdfParser, a standalone PHP library, provides various tools to extract data from a PDF file.

PdfParser Pdf Parser, a standalone PHP library, provides various tools to extract data from a PDF file. Website : https://www.pdfparser.org Test the A

Sebastien MALOT 1.7k Jan 11, 2022
A PHP tool that helps you write eBooks in markdown and convert to PDF.

Artwork by Eric L. Barnes and Caneco from Laravel News ❤️ . This PHP tool helps you write eBooks in markdown. Run ibis build and an eBook will be gene

Mohamed Said 1.5k Jan 13, 2022
Generate simple PDF invoices with PHP

InvoiScript Generate simple PDF invoices with PHP. Installation Run: composer require mzur/invoiscript Usage Example use Mzur\InvoiScript\Invoice; re

Martin Zurowietz 14 Sep 22, 2021
FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF.

FPDI - Free PDF Document Importer ❗ This document refers to FPDI 2. Version 1 is deprecated and development is discontinued. ❗ FPDI is a collection of

Setasign 718 Jan 6, 2022
Laravel Snappy PDF

Snappy PDF/Image Wrapper for Laravel 5 and Lumen 5.1 This package is a ServiceProvider for Snappy: https://github.com/KnpLabs/snappy. Wkhtmltopdf Inst

Barry vd. Heuvel 2.1k Jan 12, 2022
Sign PDF files with valid x509 certificate

Sign PDF files with valid x509 certificate Require this package in your composer.json and update composer. This will download the package and the depe

Lucas Nepomuceno 102 Jan 16, 2022
Convert a pdf to an image

Convert a pdf to an image This package provides an easy to work with class to convert PDF's to images. Spatie is a webdesign agency in Antwerp, Belgiu

Spatie 1k Jan 13, 2022
Generate pdf file with printable labels

printable_labels_pdf Generate pdf file with printable labels with PHP code. CREATE A PDF FILE WITH LABELS EASELY: You can get a pdf file with labels f

Rafael Martin Soto 3 Oct 7, 2021
A Laravel package for creating PDF files using LaTeX

LaraTeX A laravel package to generate PDFs using LaTeX · Report Bug · Request Feature For better visualization you can find a small Demo and the HTML

Ismael Wismann 43 Jan 11, 2022