Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate PDF file from HTML page while on shared hosting

I have very limited access to enable extensions etc on my hosting but am looking to generate a PDF from an HTML page (with css/images) through PHP.

Any ideas how I can achieve this with next to zero CL access etc? Preferable not a "hack" / relient on a service (as I'll be looking to use this long term).

like image 686
Jeff Andersen Avatar asked Aug 11 '10 00:08

Jeff Andersen


1 Answers

When generating HTML to render in to the PDF, create that HTML in single $html variable. This can be used to pass to the any of the pdf rendering api's.

Widely used API's are DOM PDF, html2pdf, html2ps.

Some of the API's like html2ps also supports the external css & classes also. Some required inline CSS.

I have used DOM PDF & html2ps

here are the links

domp df

HTML2PS & HTML2PDF

like image 125
Ashay Avatar answered Oct 21 '22 14:10

Ashay