The automatic creation of PDF files is one of the most important points of a project commercial or not.
In some cases, not because of exaggerated customer requirements but the library you use to generate PDF's, you'll find yourself limited and most likely in problems to provide a solution for the client. In this article, we are going to show 5 of the most imponent PDF generation libraries that will help you to achieve those complex and extense PDF's. The latest version requires at least PHP 5.
Some of our customers
Dompdf is mostly a CSS 2. 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. The following snippet shows how to generate a simple PDF and generate a direct download using Dompdf :. It uses the excellent webkit-based wkhtmltopdf and wkhtmltoimage available on OSX, linux, windows.
You will have to download wkhtmltopdf 0. These run entirely "headless" and do not require a display or display service. You can even download a wkhtmltopdf distribution as a composer dependency and reference the Binary dinamically in your project.
Github Homepage. It support customization and a lot of key features when you work with the creation of PDF files. This library supports Unicode fonts and it is actively maintained by Nicola Asuni in the Github repository.
It has a extense collection of examples and ready-to-test snippets on its official homepage. TCPDF has as main features :.
TCPDF in the first place, why?. Theoretically, the first place should be of wkhtmltopdf as it uses webkit to render your HTML and probably will be more helpful to render things as canvas, SVG etc.
However, you need to know that not every developer is able to include binaries application or executables on its projects or enjoy the privileges of do whatever he wants with the server, that's when TCPDF becomes the first option for the most developers.
If you know another awesome PHP library to generate PDF, please share it with the community in the comment box down below, have fun! Interested in programming since he was 14 years old, Carlos is the founder and author of most of the articles at Our Code World.
Proud Self-taught programmer.