问题描述
可能的重复:
Java 的 PDF 生成库
我正在为一家本地会计公司开发发票计划.用 Java 创建 PDF 文件的好方法是什么?有什么好的图书馆吗?我对 PDF 导出完全陌生(使用任何语言).
I'm working on an invoice program for a local accounting company.What is a good way to create a PDF file with Java? Any good library?I'm totally new to PDF export (On any language).
推荐答案
我更喜欢将我的数据输出到 XML(使用 Castor、XStream 或 JAXB),然后使用 XSLT 样式表将其转换为 XSL-FO 并使用 Apache FOP 将其呈现为 PDF.迄今为止已编写了 10 页的报告和 400 页的手册.我发现这比使用 iText 在代码中生成 PDF 更灵活和更具风格.
I prefer outputting my data into XML (using Castor, XStream or JAXB), then transforming it using a XSLT stylesheet into XSL-FO and render that with Apache FOP into PDF. Worked so far for 10-page reports and 400-page manuals. I found this more flexible and stylable than generating PDFs in code using iText.
这篇关于用 Java 创建 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!