PHP HelpPHP Help

Online Community that helps beginners learn PHP,
and webmasters solve PHP coding problems

since 1999

Print to PDF

Developing PDF printer

Many users on our forum ask: "How do I print to PDF?". Printing to PDF is easy with PHP. There are many libraries and classes that work with PDF format and allow to create PDF files as well as print text and images to PDF file. In this brief tutorial we will use great DOMPDF class - an HTML to PDF converter utility. Main features of this class are:

  • handles most CSS2.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, bmp & jpeg)
  • no dependencies on external PDF libraries, thanks to the R&OS PDF class
  • inline PHP support.

Copyright © 2018