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.
我对主机上的扩展等的访问非常有限,但是我希望通过PHP从HTML页面(带有css/图像)生成PDF。
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).
有什么想法可以让我在接近零CL访问的情况下实现吗?最好不要在服务上使用“hack”或“relient”(因为我打算长期使用它)。
4 个解决方案
#1
4
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.
在生成HTML以呈现到PDF时,使用单个$ HTML变量创建该HTML。这可以用来传递给任何pdf呈现api。
Widely used API's are DOM PDF, html2pdf, html2ps.
广泛使用的API是DOM PDF, html2pdf, html2ps。
Some of the API's like html2ps also supports the external css & classes also. Some required inline CSS.
有些API如html2ps也支持外部css和类。一些需要内联CSS。
I have used DOM PDF & html2ps
我使用了DOM PDF和html2ps
here are the links
这里是链接
domp df
HTML2PS & HTML2PDF
#2
3
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
有许多解决方案存在:domPdf、mPdf、html2pdf、tcpdf、zendPDF (zend framework)等。我广泛地使用了domPdf和mPdf,还有一些只是“顺便”使用。domPdf非常简单,但是它不太有花哨的功能。html2pdf也不错,但是我偏爱mPDF,因为我相信它有最好的功能。有关完整的文档,请参见这个链接:http://mpdf1.com/manual/index.php
I've converted pretty complicated web pages into pdf and mPDF seems to render them the best.
我已经把相当复杂的网页转换成pdf格式,mPDF看起来是最好的。
#3
2
Found this yesterday just here at SO: mPDF. Haven't tried it, but the documentation is solid.
昨天就在这里找到了:mPDF。还没有尝试过,但是文档是可靠的。
#1
4
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.
在生成HTML以呈现到PDF时,使用单个$ HTML变量创建该HTML。这可以用来传递给任何pdf呈现api。
Widely used API's are DOM PDF, html2pdf, html2ps.
广泛使用的API是DOM PDF, html2pdf, html2ps。
Some of the API's like html2ps also supports the external css & classes also. Some required inline CSS.
有些API如html2ps也支持外部css和类。一些需要内联CSS。
I have used DOM PDF & html2ps
我使用了DOM PDF和html2ps
here are the links
这里是链接
domp df
HTML2PS & HTML2PDF
#2
3
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
有许多解决方案存在:domPdf、mPdf、html2pdf、tcpdf、zendPDF (zend framework)等。我广泛地使用了domPdf和mPdf,还有一些只是“顺便”使用。domPdf非常简单,但是它不太有花哨的功能。html2pdf也不错,但是我偏爱mPDF,因为我相信它有最好的功能。有关完整的文档,请参见这个链接:http://mpdf1.com/manual/index.php
I've converted pretty complicated web pages into pdf and mPDF seems to render them the best.
我已经把相当复杂的网页转换成pdf格式,mPDF看起来是最好的。
#3
2
Found this yesterday just here at SO: mPDF. Haven't tried it, but the documentation is solid.
昨天就在这里找到了:mPDF。还没有尝试过,但是文档是可靠的。