1

First, I tried to use Cloudconvert. It can convert between so many fyletypes, but its PHP API causes memory leaks almost at all times.

The second I tried was Pdfcrowd. It works perfectly, but it can convert only HTML to PDF.

The third I tried was Pdfaid. It works also perfectly, but it can convert only PDF to DOCX.

But the second and the third have conversion limits (Pdfaid has only 20 conversions per API key), which can be extended by paying.

Do you have any experiences with some other PHP APIs or libraries?

aleskva
  • 1,644
  • 2
  • 21
  • 40
  • You can maybe use free DomPDF which converts HTML to PDF (not an API but a library), and the use PdfAid. – Vincent Decaux May 11 '14 at 15:13
  • @Matt I actually use this combo, but because of the limit (20 conversions per API key) in Pdfaid I'm looking for something new. – aleskva May 11 '14 at 15:16

4 Answers4

3

There are few api's. I hope it will help you.

DOMPDF : php class that wrap the html and build the pdf. Works good, customizable (if you know php), based on pdflib, if i remember right it takes even some CSS. Bad news: slow when the html is big or many complex. https://github.com/dompdf/dompdf

HTML2PS: same of DOMPDF, but this one convert first in .ps (ghostscript), then, in whatever format you need (pdf, jpg, png). For me is little better then dompdf, but have the same speed problem.. oh, better compatibility with css. http://www.tufat.com/s_html2ps_html2pdf.htm

Those two are php classes, but if you can install some software on the server, and access it throught passthru() or system(), give a look to these too:

wkhtmltopdf: based on webkit (safari's wrapper), is really fast and powerfull.. seem like is the best one (atm) for convert on the fly html pages to pdf, taking only 2 seconds for a 3 pages xHTML document with CSS2. Is a recent project, anyway, the google.code page is often updated.

htmldoc : this one is a tank, it really never stop/crash.. the project seem death in the 2007, but anyway if you dont need css compatibility this can be nice for ya

Ruchi
  • 31
  • 3
  • It is a shame, that I can not install nothing to the server. If I can, I would install Node.js and Dart and much more. But the first two looks quite good, I'll try, which is faster for my project and then decide. – aleskva May 11 '14 at 15:24
  • @aleskva what is the most performant option? – Alcides Dec 21 '18 at 23:42
3

I prefer DOMPDF. I have used it and it is easy to use. As @Ruchi Suggested HTMLS2PS is also nice option.

1

You might have better luck at finding a good way to do this at Stack Overflow Software Recommendations.

I once used this converter to convert to DOCX, which worked fine for me. I have no experience with converting HTML to PDF.

Community
  • 1
  • 1
BananaMan
  • 168
  • 1
  • 10
  • I didn't know about this Stack Overflow service, thanks. And this converter seems to be great, but little complicated. I'll try to use it – aleskva May 11 '14 at 15:18
0

According to answers from @Ruchi and @BananaMan, I'll try to use the combination of HTML to docx and dompdf libraries instead of the former combination of Pdfcrowd and Pdfaid limited APIs. Thank you so much for your answers.

aleskva
  • 1,644
  • 2
  • 21
  • 40