Php best pdf generator.

If you are looking for php pdf library i can give you a clear view point for you. As i have searched a lot in google in this topic but i did not get proper guide line in PHP. PHP manual suggests to use PDFlib which is not free to use. You need to purchase PDFlib for use.

There are some PHP library available to generate PDF. If you want to generate pdf your webpage or want to write a wordpress plugin to generate PDF you can use any of them. I have written below some widely used php library comparison.


1.FPDF :

Fpdf is a free PHP class to generate pdf. You can use it any kind of purpose even commercially and you are allowed to modify source code.

  1. Using FPDF you can set your  custom page margin .
  2. Easy to manage header and footer
  3. You can set automatic page break option.
  4. Colors, links and page compression options are available.



This is one of worlds most active pdf php open source library since 2002. It has very rich feature :

  1. No external libraries are required for the basic functions.
  2. All standard page formats, custom page formats, custom margins and units of measure.
  3. UTF-8 Unicode and Right-To-Left languages.
  4. TrueTypeUnicode, OpenTypeUnicode v1, TrueType, OpenType v1, Type1 and CID-0 fonts.
  5. Methods to publish some XHTML + CSS code, Javascript and Forms.
  6. Images, graphic (geometric figures) and transformation methods and many more.



Mpdf is a php class which is build with FPDF and HTML2FPDF with a number of change and feature enhanced. It is developed by Ian Back and released under GNU GPL version 2 license .

It is now widely used to generate html to pdf on a fly. It supports all css styles and html standard tag. You can save your pdf file in a directory or give a download option. You can attach generated pdf to e-mail as well. It supports almost all language in the worlds.



Wkhtmltopdf is an open source (LGPLv3) command line tools to convert HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely “headless” and do not require a display or display service.
There is also a C library, if you’re into that kind of thing.


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.


06. Zend_Pdf

The Zend_Pdf component is a PDF (Portable Document Format) manipulation engine. It can load, create, modify and save documents. Thus it can help any PHP application dynamically create PDF documents by modifying existing documents or generating new ones from scratch. Zend_Pdf offers the following

07. php To PDF

To PDF is an API based solution. You need to sign up for a free api key from phptopdf site to generate pdf document.You do not need any special packages or permissions. It works on any server running PHP!.It has simplified API system so that you just need to download the phpToPDF.php file from your account and include it in your code. It’s that simple.