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

    Kaustubh Katdare

    Administrator

    Updated: Oct 26, 2024
    Views: 1.4K
    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?
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Manish Goyal

    MemberDec 16, 2016

    Ignore everything and use wkhtmltopdf

    <a href="https://wkhtmltopdf.org/" target="_blank" rel="nofollow noopener noreferrer">wkhtmltopdf</a>

    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
    Are you sure? This action cannot be undone.
    Cancel
  • Kaustubh Katdare

    AdministratorDec 16, 2016

    Interesting suggestion, #-Link-Snipped-# . 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.
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberDec 16, 2016

    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
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register