PHPExcel 创建/样式/保存 PDF 文档
我在几个项目中使用 PHPExcel 库,并且喜欢它提供的功能。目前,我需要另存为 PDF,发现 PHPExcel 可以做到这一点,但我发现很难找到有关该过程的一些示例或文档。
以下是我找到的链接:
- http://phpexcel.codeplex.com/wikipage?title =News%20archive
- http://www.devshed.com/c/a/PHP/PHP-Excel-Working-with-Workbook-and-PDF-Files/1/
跟进问题:
我需要PDF 的外观和功能类似于表单,能够预填充数据字段并选择不同的选项。 PHPExcel 是正确的选择吗?目前我在命令行上使用 pdftk ,更改服务器导致了需要降级的问题版本为旧版本。这很好,但我想我正在寻找替换它并采用基于 PHP 的方法。
想法?建议?
I'm using the PHPExcel library in a couple of project and love the functionality it provides. Currently I needed to save as a PDF and found that PHPExcel can do this but I'm finding it rather hard to track down some examples or documentation on the process.
Here are the links I have found:
- http://phpexcel.codeplex.com/wikipage?title=News%20archive
- http://www.devshed.com/c/a/PHP/PHP-Excel-Working-with-Workbook-and-PDF-Files/1/
Follow up question:
I need the PDF to look and function as a form, the ability to prefill data fields, and select different options. Would PHPExcel be the right choice for this? Currently I'm using pdftk on the command line and changing servers has caused the problem of needing to downgrade the version to an older one. This is fine but I think I'm looking to replace this and go with a PHP based approach.
Thoughts? Suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PHPExcel 使用 tcpdf 库 来呈现 PDF。如果您查看相应的源代码,您会发现它并没有不允许外部访问它创建的 PDF 对象。 tcpdf 确实支持表单元素,因此您的解决方案似乎是为 PHPExcel 编写您自己的 Writer 类,或者只是修改该代码,以便您可以获得所需的结果。
PHPExcel uses the tcpdf library to render the PDF. If you look at the appropriate source code, you'll see it doesn't allow external access to the PDF object it creates. tcpdf does support form elements, so it appears your solution is to write your own Writer class for PHPExcel or just modify that code so you can get the results you're looking for.