使用PHP从纯文本和HTML文本混合创建PDF [英] Using PHP to create a PDF from a mix of plain text and HTML text

查看:90
本文介绍了使用PHP从纯文本和HTML文本混合创建PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

使用PHP将HTML + CSS转换为PDF?

我有一个包含5个字段的表单,其中两个是使用tinyMCE扩展的文本框,其余是简单的文本输入类型。

I have a form with 5 fields, two of which are textboxes extended with tinyMCE, the rest are simple inputs of type text.

我需要生成一个PDF从这个输入。我知道我可以使用Zend_Pdf生成PDF并包含纯文本数据。但是,例如,我可以在tinyMCE字段中包含项目列表吗?

I need to generate a PDF from this input. I understand that I can use Zend_Pdf to generate the PDF and include the plain text data. But how, for example, can I include a bulleted list from the tinyMCE fields?

最好的方法是创建一个HTML文件,然后使用例如DOMPDF或HTML2PDF?理想情况下,我宁愿使用zend框架来创建文档,定位并插入字段,并保存。

Would the best way be to create an HTML file, and then use for example DOMPDF or HTML2PDF? Ideally, I'd prefer to just use the zend framework to create the document, position and insert the fields, and save.

预先感谢。

推荐答案

FPDF是PHP4非常古老的库。现在它可能不会工作。我建议使用 DOMPDF TCPDF 。它们都用于PHP5 +,并且可以在一定程度上使用HTML或CSS。

FPDF is very old library for PHP4. It propably won't even work nowadays. I'd recommend DOMPDF or TCPDF. They both are for PHP5+ and can eat HTML or CSS to some degree.

这篇关于使用PHP从纯文本和HTML文本混合创建PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆