Create PDF file from HTML page during sharing

I have very limited access to the extension, etc. on my hosting, but I want to create a PDF file from an HTML page (using css / images) via PHP.

Any ideas on how I can achieve this using CL null access etc.? It is preferable not to "hack" / "reliant" in the service (as I will use this long term).

+4
source share
4 answers

When creating HTML for rendering in PDF, create this HTML file in a single $ html variable. This can be used to jump to any of the PDF rendering api.

A widely used API is DOM PDF, html2pdf, html2ps.

Some of the APIs, such as html2ps, also support external css and classes. Some required inline CSS.

I used DOM PDF and html2ps

here are the links

domp df

HTML2PS and HTML2PDF

+4
source

There are a number of solutions: domPdf, mPdf, html2pdf, tcpdf, zendPDF (zend framework), etc. I used domPdf and mPDF very widely, while others are just "in passing." domPdf is very simple, but does not have bells and whistles. html2pdf is not bad either, however, I am partly mPDF-specific, since I think it has the best feature set. For full documentation see this link: http://mpdf1.com/manual/index.php

I turned pretty sophisticated web pages into pdfs and mPDF seems to make them better.

+3
source

Found it yesterday here in SO: mPDF . I have not tried it, but the documentation is solid.

+2
source

Check out html2pdf , I never used it, but it looks promising.

+1
source

All Articles