[英]HTML+CSS to RTF (in PHP)?
I am seeking a solution to converting HTML + CSS (2.1) to RTF in PHP. 我正在寻找一种解决方案,将HTML + CSS(2.1)转换为PHP中的RTF。 While I have found a superb solution for HTML to PDF in Prince XML , I've yet to find anything that:
虽然我在Prince XML中找到了HTML到PDF的优秀解决方案,但我还没有找到任何:
Is there anything out there? 那里有什么吗?
The easiest way to do this is using phpLiveDocx . 最简单的方法是使用phpLiveDocx 。 It is component for the Zend Framework and completely free.
它是Zend Framework的组件,完全免费。
Supported template file formats (input) 支持的模板文件格式(输入)
Supported document file formats (output) 支持的文档文件格式(输出)
From the project web site: 从项目网站:
"phpLiveDocx allows developers to generate documents by combining structured data from PHP with a template, created in a word processor. The resulting document can be saved as a PDF, DOCX, DOC or RTF file. The concept is the same as with mail-merge." “phpLiveDocx允许开发人员通过将来自PHP的结构化数据与在文字处理器中创建的模板相结合来生成文档。生成的文档可以保存为PDF,DOCX,DOC或RTF文件。这个概念与mail-merge相同“。
For details, see: 有关详情,请参阅:
http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/ http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/
For all your document conversion needs , you can use OpenOffice (running in headless mode.) You may invoke it with command-line parameters to perform conversion, or you may interface with it using PUNO . 对于所有文档转换需求 ,您可以使用OpenOffice (在无头模式下运行。)您可以使用命令行参数调用它来执行转换,或者您可以使用PUNO 与它进行交互 。 You may spawn a new OpenOffice instance everytime you need conversion, or you may have one ore more instances run as daemon(s).
您可以在每次需要转换时生成一个新的OpenOffice实例,或者您可能有一个或多个实例作为守护程序运行。
With either interfacing choice, you will probably want to use a macro to add custom headers and footers after opening the html, but before exporting as Word. 使用任何接口选择,您可能希望在打开html之后但在导出为Word之前使用宏来添加自定义页眉和页脚。
There is a PHP wrapper for HTML-to-PDF converter PD4ML . 有一个用于HTML-to-PDF转换器PD4ML的PHP包装器。 Optionally PD4ML can produce RTF instead of PDF .
可选PD4ML可以生成RTF而不是PDF 。 You just only need to add -outformat rtf or -outformat rtfwmf to its command line (and adjust HTTP header correspondingly).
您只需要在其命令行中添加-outformat rtf或-outformat rtfwmf (并相应地调整HTTP标头)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.