Hello, what is the best and easiest way to create PDF files with PHP?
I know about libs like fpdf, tcpdf and wkhtmltopdf. But they have all their own limitations.
What is your preferred way to create pdf files with php, optimaly by transforming a html file?
Top comments (3)
I got pretty far with wkhtmltopdf, but it can be tricky or one is not able to install the latest version at all (depending on hosting plan)
There is a python lib weasy print, that seems to be good, but you need to install a ton of stuff.
Typeset.sh typeset.sh/en/ is pure php and seems to be pretty good, but it is expensive.
Here is an overview: html2pdf.guru/
I used "spipu/html2pdf" for a while, then switched to mpdf (way faster, and a little more css complaint).
The workflow always being: take the html, give me the pdf.
No mater what you choose, be prepared for some pain...
I've been using TCPDF with Laravel for simple or complex printing or parsing html to pdf