Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

I have an HTML (not XHTML) document that renders fine in Firefox 3 and IE 7. It uses fairly basic CSS to style it and renders fine in HTML.

I'm now after a way of converting it to PDF. I have tried:

  • DOMPDF: it had huge problems with tables. I factored out my large nested tables and it helped (before it was just consuming up to 128M of memory then dying--that's my limit on memory in php.ini) but it makes a complete mess of tables and doesn't seem to get images. The tables were just basic stuff with some border styles to add some lines at various points;

  • HTML2PDF and HTML2PS: I actually had better luck with this. It rendered some of the images (all the images are Google Chart URLs) and the table formatting was much better but it seemed to have some complexity problem I haven't figured out yet and kept dying with unknown node_type() errors. Not sure where to go from here; and

  • Htmldoc: this seems to work fine on basic HTML but has almost no support for CSS whatsoever so you have to do everything in HTML (I didn't realize it was still 2001 in Htmldoc-land...) so it's useless to me.

I tried a Windows app called Html2Pdf Pilot that actually did a pretty decent job but I need something that at a minimum runs on Linux and ideally runs on-demand via PHP on the Web Server.

What am I missing, or how can I resolve this issue?

1 Answer

0 votes
by (106k points)

You can use the below-mentioned online services that can convert HTML + CSS to PDF with PHP:-

  • PDFShift

  • Restpack

  • PDF Layer

  • DocRaptor

  • HTMLPDFAPI

  • HTML to PDF Rocket

Also, you can have a look at PrinceXML. Which is the best HTML/CSS to PDF converter.

Related questions

0 votes
2 answers
0 votes
1 answer
asked Aug 3, 2019 in Web Technology by Tech4ever (20.3k points)
0 votes
1 answer
0 votes
1 answer

31k questions

32.7k answers

501 comments

693 users

Browse Categories

...