创建 PDF 文档
我正在构建一个 Web 应用程序,需要为每个客户创建文档。这些文件将以 pdf 格式保存。
我正在寻求有关这些报告的处理和生成的帮助,我应该使用 doc/docx 模板并将该数据加载到文件中,然后创建 pdf(如果可能),还是在 html/css 中创建文档并然后使用 dompdf 或类似的东西来创建 pdf?
我使用 codeigniter 作为我的框架。
I'm in the process of building a web application and will need to create documentation on a customer by customer basis. These files will be saved in pdf format.
I'm looking for help in the process and production of these reports, should I use a doc/docx template and load that data into the file then create the pdf (if it is possible), or create the document in html/css and then use dompdf or something similar to create the pdf?
I'm using codeigniter as my framework.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我想是个人喜好,但我真的很喜欢 XSLFO 和 FOP。 http://grover.open2space.com/content/creating-pdf-code-fop
Personal preference I guess, but I really like XSLFO and FOP. http://grover.open2space.com/content/creating-pdf-code-fop
MPDF 为我创造了奇迹。这是一个 HTML 到 PDF 的程序。它支持相当多的 CSS,而且我通常发现它很容易使用。
我的应用程序正在创建 100 多个页面报告,具有不同的页面布局/方向、多个表格、图像、字体、PDF 导入等,并且 MPDF 部分工作可靠。
MPDF has worked wonders for me. It's an HTML to PDF program. It supports quite a bit of CSS, and I generally found it easy to work with.
My application is creating 100+ page reports with different page layouts/orientations, multiple tables, images, fonts, PDF imports, etc, and the MPDF part works reliably.
个人经验:我使用过 tcpdf 并对得到的结果感到满意。
Personal experience: I have used tcpdf and was satisfied with the result I got.
我发现几乎所有 PDF 创建库的排版质量都非常糟糕。如果确实可以选择,您可以考虑将数据粘贴到 LaTeX 模板中,并在其上运行
pdflatex
(或xelatex
),以获得美观、高质量的结果文档。这将需要您进行一定量的设置和开发,但它有可能看起来比任何直接 PDF 创建结果都要好得多。
I've been finding that the typographic quality of just about any PDF creation library is utterly gutterly. If it's an option at all, you might consider pasting your data into a LaTeX template and running
pdflatex
on that (orxelatex
) to get a nice-looking, high-quality document.This will require a certain amount of setup and development on your part, but there's a chance that it'll look infinitely better than any direct PDF creation results.