Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

socieboy's avatar

Best PDF generator?

I have been used TCPDF but I would like to heard other options?

0 likes
12 replies
ayazi_1's avatar

It's working fine on Local but not working on Live server Please help thanks

RayRutjes's avatar

+1 for wkhtmltopdf, it is definitely the best you can find

rjv's avatar

I'm not sure if you're open to using a front-end library, but I've had decent luck with jsPDF ( http://parall.ax/products/jspdf ).

Admittedly, I'm not very pleased with their documentation.. I had to do a lot of digging through the source to find certain methods. I had a short Twitter conversation with the main developer and he said there's a major revision on its way with some interesting HTML-to-PDF translation capabilities. Hopefully the docs improve.

1 like
carkis's avatar

+1 for wkhtmltopdf, it is specially useful when using a css framework like twitter bootstrap or zurb foundation, the others simply destroy what I preview in the browser.

EliasSoares's avatar

Someone knows any library that convert HTML to PDF and allow paginate correctly, break page correctly and ...?

I use in one old app HTML + Chrome PDF Printer, but there are many bugs in rendering...

EliasSoares's avatar

@carkis

This works fine, but my biggest problem is with page-break-before: always | avoid...

In my case, we "draw" an entire tour guide dinamically, and it need to be nicely formated... :/ Also page numbers don't work...

I think that the best is to draw the PDF manualy! :/

anam's avatar

You can try PhantomMagick. PhantomMagick provides a simple API to ease the process of converting HTML to PDF or images.

https://github.com/anam-hossain/phantommagick

Features

  • Convert HTML to a PDF
  • Convert HTML to an image (PNG, JPG or GIF)
  • Support multipage PDFs
  • Capture a web page as a screenshot
  • Save PDF or image to local disk or to the cloud (S3, Dropbox or Rackspace)
  • Framework agnostic, with optional Laravel integration

https://github.com/anam-hossain/phantommagick

1 like

Please or to participate in this conversation.