HTML+CSS 到 RTF(PHP)?

发布于 2024-07-14 09:03:34 字数 324 浏览 5 评论 0原文

我正在寻找一种在 PHP 中将 HTML + CSS (2.1) 转换为 RTF 的解决方案。 虽然我在 Prince XML 中找到了 HTML 到 PDF 的绝佳解决方案,但我还没有找到任何可以

  • :将 HTML 转换为 RTF(或 DOC);
  • 运行在Linux服务器上;
  • 可从 PHP 调用;
  • 处理分页媒体以及添加页眉和页脚的能力; 并
  • 处理桌子。

外面有什么吗?

I am seeking a solution to converting HTML + CSS (2.1) to RTF in PHP. While I have found a superb solution for HTML to PDF in Prince XML, I've yet to find anything that:

  • can convert HTML to RTF (or DOC);
  • runs on a Linux server;
  • is callable from PHP;
  • handles paged media and the ability to add page headers and footers; and
  • handles tables.

Is there anything out there?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

愚人国度 2024-07-21 09:03:34

最简单的方法是使用 phpLiveDocx。 它是 Zend Framework 的组件并且完全免费。

支持的模板文件格式(输入)

  • DOCX - Microsoft Word DOCX 格式
  • DOC - Microsoft Word DOC 格式
  • RTF - 富文本格式文件
  • TXD - TX 文本控制格式

支持的文档文件格式(输出)

  • DOCX - Microsoft Word DOCX 格式
  • DOC - Microsoft Word DOC 格式
  • RTF - 富文本格式文件
  • PDF - Acrobat 便携式文档格式
  • TXD - TX 文本控制格式
  • TXT - ANSI 纯文本

来自项目网站:

“phpLiveDocx 允许开发人员通过将 PHP 中的结构化数据与在 word 中创建的模板相结合来生成文档生成的文档可以保存为 PDF、DOCX、DOC 或 RTF 文件。这一概念与邮件合并相同。”

详情请参阅:

http://www.phplivedocx.org/articles/brief -phplivedocx简介/

The easiest way to do this is using phpLiveDocx. It is component for the Zend Framework and completely free.

Supported template file formats (input)

  • DOCX - Microsoft Word DOCX Format
  • DOC - Microsoft Word DOC Format
  • RTF - Rich Text Format File
  • TXD - TX Text Control Format

Supported document file formats (output)

  • DOCX - Microsoft Word DOCX Format
  • DOC - Microsoft Word DOC Format
  • RTF - Rich Text Format File
  • PDF - Acrobat Portable Document Format
  • TXD - TX Text Control Format
  • TXT - ANSI Plain Text

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."

For details, see:

http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/

烈酒灼喉 2024-07-21 09:03:34

为了满足您的所有文档转换需求,您可以使用 OpenOffice(在无头模式下运行。 )您可以使用命令行参数调用它来执行转换,或者您可以使用 PUNO。 每次需要转换时,您都可以生成一个新的 OpenOffice 实例,或者您可以让一个或多个实例作为守护进程运行。

无论选择哪种接口,您可能都希望在打开 html 之后、导出为 Word 之前使用宏来添加自定义页眉和页脚。

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. You may spawn a new OpenOffice instance everytime you need conversion, or you may have one ore more instances run as daemon(s).

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.

雨落□心尘 2024-07-21 09:03:34

有一个用于 HTML 到 PDF 转换器 PD4ML 的 PHP 包装器。 (可选)PD4ML 可以生成 RTF 而不是 PDF。 您只需要在其命令行中添加-outformat rtf-outformat rtfwmf(并相应调整HTTP标头)。

There is a PHP wrapper for HTML-to-PDF converter PD4ML. Optionally PD4ML can produce RTF instead of PDF. You just only need to add -outformat rtf or -outformat rtfwmf to its command line (and adjust HTTP header correspondingly).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文