自动生成 PDF
用于生成 PDF 报告的可靠工具是什么?特别是,我们对创建包含视频的交互式 PDF 感兴趣,例如此处< /a>.
现在我们正在使用Python和reportlab来生成PDF,但还没有完全探索这个库(主要是因为许可证定价有点过高)
我们一直在研究 Adobe 的 SDK 和 iText 库,但很难说它们的功能是什么。
能够从 PDF 模板生成文档将是一个优势。
任何指示或评论将不胜感激。
谢谢,
What would be a solid tool to use for generating PDF reports? Particularly, we are interested in creating interactive PDFs that have video, like the example found here.
Right now we are using Python and reportlab to generate PDFs, but have not explored the library completely (mostly because the license pricing is a little prohibitive)
We have been looking at the Adobe's SDK and iText libraries but it's hard to say what the capabilities of either are.
The ability to generate a document from a template PDF would be a plus.
Any pointers or comments will be appreciated.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最近,我需要为 Django 应用程序创建 PDF 报告;可以使用 ReportLab 许可证,但我最终选择了 LaTeX。这种方法的好处是我们可以使用 Django 模板 来生成 LaTeX源,而不必为我们需要创建的许多报告编写大量代码。另外,我们可以利用相对更简洁的 LaTeX 语法(它确实有很多怪癖,并且并不适合所有用途)。
此代码段提供了该方法的总体概述。我发现有必要进行一些更改,我已在本问题末尾提供了这些更改。主要添加的是对
Rerun LaTeX
消息的检测,这表明需要额外的传递。用法很简单:可以将视频嵌入 LaTeX 生成的 PDF 中,但我没有任何经验。 此处是顶部Google 结果。
该解决方案确实需要生成一个新进程 (
pdflatex
),因此如果您想要纯 Python 解决方案,请继续寻找。Recently, I needed to create PDF reports for a Django application; a ReportLab license was available, but I ended up choosing LaTeX. The benefit of this approach is that we could use Django templates to generate the LaTeX source, and not get over encumbered writing lots of code for the many reports we needed to create. Plus, we could take advantage of the relatively much more concise LaTeX syntax (which does have it's many quirks and is not suitable for every purpose).
This snippet provides a general overview of the approach. I found it necessary to make some changes, which I have provided at the end of this question. The main addition is detection for
Rerun LaTeX
messages, which indicates an additional pass is required. Usage is as simple as:It is possible to embed videos in LaTeX generated PDFs, however I do not have any experience with it. Here is a top Google result.
This solution does require spawning a new process (
pdflatex
), so if you want a pure Python solution keep looking.我建议使用 https://github.com/mreiferson/py-wkhtmltox 将 HTML 渲染为PDF。
并使用您选择的任何工具将报告呈现为 HTML。我喜欢 http://www.makotemplates.org/
I suggest to use https://github.com/mreiferson/py-wkhtmltox to render HTML to PDF.
And use any tool you choose to render reports as HTML. I like http://www.makotemplates.org/