10

Possible Duplicate:
Convert HTML + CSS to PDF with PHP?

i'm looking for a pdf library which can render html into a pdf, with support for css + images. any suggesstions?

thanks

Community
  • 1
  • 1
Fuxi
  • 7,611
  • 25
  • 93
  • 139

2 Answers2

6

You should Google search first.

I used to use TCPDF and DOMPDF but they fail massively in many cases.

I've started using WKhtmltox tools a year or so ago, been adding to it ever since.

Since it relies on webkit, you get the benefit of some CSS 3 and HTML 5.

Keep in mind this uses a real browser (webkit) thus most quirks are addressed by major browsers like chrome and safari. The alternatives, on the other hand, have their own problems. I remember being bugged with TCPDF tables, for example.

Christian
  • 27,509
  • 17
  • 111
  • 155
  • +1 - use this to create thousands of PDF invoices a month and never (touch wood) let me down yet .. some PDFs are over 2000 pages long .. full of HTML tables – Manse Dec 09 '11 at 11:24
  • TCPDF is an easy install for PHP, not much effort to get it going. But it uses absolutely massive amounts of CPU and memory. Plus as others mentions it can fail also. Im going to switch to WK, seems to be the best method. – The Thirsty Ape May 09 '13 at 18:29
1

tcPDF, domPDF and mPDF all provide an HTML to PDF that supports styling (and I believe images as well). These are all pure PHP libraries, with no external dependencies, or command line requirements. There may be others as well.

Mark Baker
  • 209,507
  • 32
  • 346
  • 385