Antonie PotgieterI (Antonie Potgieter) am a software engineer/web developer located in South Africa. My full-time work is the management of Tribulant Software and the development of its software packages.


I’ve pretty much tried all the PDF libraries out there for saving HTML to PDF appropriately and correctly using PHP and came to a conclusion (continue reading).

The one that worked the fastest and most efficiently was the HTML to PDF class on PHP Classes but eventually this EasySW remote HTML to PDF service in the HTML to PDF class stopped serving PDF files from HTML submissions as the Easy Software closed their business.

I then tried several others and it seems like DomPDF is the most robust and thorough library, parsing all formatting, styling, etc. from the HTML into the PDF file. There are certain things which are not supported such as floats but overall the DomPDF library is great and very effective. Best is that you don’t have to rely on a 3rd party service shutting down, this runs inside your application.

I’ll show you how to use DomPDF in PHP to generate PDF files from HTML code.