HTML To PDF Rendering Engine: dompdf

dompdf is a HTML to PDF conversion / rendering engine written in PHP 5.

It downloads and reads external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes.


It enables rendering via PDFlib or R&OS CPDF class which can be selected.

Some features of dompdf:

  • handles most CSS2.1 properties & selectors, including @import, @media & @page rules
  • supports most presentational HTML 4.0 attributes
  • supports external stylesheets, either on the local machine or through http/ftp (via fopen-wrappers)
  • supports complex tables, including row & column spans, separate & collapsed border models, individual cell styling, multi-page tables (no nested tables yet however)
  • image support (png, gif & jpeg)
  • link and anchor support
  • inline PHP support.

P.S. A security vulnerability exists with dompdf but also the solution can be foundfor it at the product page.

  • It works for small file but give error “Internal Server Error” if html table is big size i.e. more then 3kb. You can see this issue on

  • Mona

    Would you please confirm us if dompdf supports javascript using tag. If so please kindly give us some details on how to use the tag with dompdf?

    I already tried using the tag, but dompdf doesnt show me any sort of reaction:-(

    I really need this favour to complete my module.

    Thanks in advance,
    Appreciate any help…!

  • This is something that I will find very useful, thanks!