Giter Site home page Giter Site logo

dompdf's Introduction

Latest Stable Version Total Downloads Latest Unstable Version License

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


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


Follow us on Twitter Follow us on Google+

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

Requirements

  • PHP 5.0+ (5.3+ recommended)
  • DOM extension
  • GD extension

Recommendations

  • MBString extension: provides internationalization support. This extension is not enabled by default. dompdf has limited internationalization support when this extension is not enabled.
  • opcache (OPcache, XCache, APC, etc.): improves performance

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).

Easy Installation

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
git submodule init
git submodule update

Install with composer

To install with Composer, simply add the requirement to your composer.json file:

{
  "require" : {
    "dompdf/dompdf" : "0.6.*"
  }
}

And run Composer to update your dependencies:

$ curl -sS http://getcomposer.org/installer | php
$ php composer.phar update

Before you can use the Composer installation of DOMPDF in your application you must disable dompdf's default auto-loader, include the Composer autoloader, and load the dompdf configuration file:

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

// disable DOMPDF's internal autoloader if you are using Composer
define('DOMPDF_ENABLE_AUTOLOAD', false);

// include DOMPDF's default configuration
require_once '/path/to/vendor/dompdf/dompdf/dompdf_config.inc.php';

Download and install

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

Limitations (Known Issues)

  • not particularly tolerant to poorly-formed HTML input. To avoid any unexpected rendering issues you should either enable the built-in HTML5 parser (via the DOMPDF_ENABLE_HTML5PARSER configuration constant) or run your HTML through a HTML validator/cleaner (such as Tidy).
  • large files or large tables can take a while to render
  • CSS float is not supported (but is in the works, enable it through the DOMPDF_ENABLE_CSS_FLOAT configuration constant).
  • If you find this project useful, please consider making a donation.

(Any funds donated will be used to help further development on this project.) Donate button

dompdf's People

Contributors

12hys avatar alreece45 avatar alxndrmlr avatar amacneil avatar bsweeney avatar caporaldead avatar denis-sokolov avatar derekdreery avatar donatj avatar doubleslash avatar eddturtle avatar flaviencrochard avatar itsgoingd avatar mattleff avatar mechjagger avatar mozmorris avatar pauln avatar phenx avatar vkeranov avatar zimmski avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.