View Feed
PHP Programmers
Community for PHP Programmers : Ask questions, doubts and help each other get better at PHP
269 Members
Join this group to post and comment.
Kaustubh Katdare
Kaustubh Katdare • Dec 16, 2016

html -> PDF conversion in PHP - class / service recommendations?

I'm looking to convert html into pdf in my php code and have been trying my hand at various classes and services available. What I need to do is convert my simple HTML invoice into a PDF and send it as an attachment. The existing classes seem to be quite complicated and resource heavy (opinion based upon comments from other users).

Do you have any specific recommendations?
Ignore everything and use wkhtmltopdf


Wkhtmltopdf is not a php class it is a linux utility, so your server must have it installed

you can use it inside php using exec()

exec(wkhtmltopdf x.html x.pdf");

It is best according to me
Kaustubh Katdare
Kaustubh Katdare • Dec 17, 2016
Interesting suggestion, @Manish Goyal . I'm wondering if using a php class based solution would be a better option. My requirements are super-basic; I only want a basic CSS+HTML conversion into PDF. No tables and fancy fonts at all.
In that case DOM PDF is also good, wkhtmltopdf will simply convert html design into pdf as it is without any variation, also there are no issues of memory leak or anything for large html page

Share this content on your social channels -