开发者

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 开发者_如何学Pythonwith next to zero CL access etc? Preferable not a "hack" / relient on a service (as I'll be looking to use this long term).


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


A number of solutions exist out there: domPdf, mPdf, html2pdf, tcpdf, zendPDF (zend framework) etc. I have used domPdf and mPDF very extensively and others just "in passing". domPdf is very easy but doesn't quite have the bells and whistles. html2pdf is not bad either, however, I am partial to mPDF as I believe it has the best set of features out there. For full documentation see this link: http://mpdf1.com/manual/index.php

I've converted pretty complicated web pages into pdf and mPDF seems to render them the best.


Found this yesterday just here at SO: mPDF. Haven't tried it, but the documentation is solid.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜