Java PDF生成库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10473764/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java PDF generating library
提问by MyTitle
Which Java PDF library to use in commercial project? I need to generate a printable(and good if it will be editable, like .xls) report (it contains table, some text and report's total page count - this is because I can't use HTML( I can't calculate page count)). P.S. I can't use iText because it's licence don't allow to use free version of iText in commercial projects.
在商业项目中使用哪个 Java PDF 库?我需要生成一个可打印的(如果它可以编辑就好了,比如.xls)报告(它包含表格、一些文本和报告的总页数 - 这是因为我不能使用 HTML(我无法计算页数) ))。PS 我不能使用 iText 因为它的许可证不允许在商业项目中使用 iText 的免费版本。
Thanks.
谢谢。
回答by Paul Sanwald
We are in the same boat at my job, and are moving to pdfbox. For what it's worth, generating real print quality PDFs (like, ones that get printed hardcopy by a print company) for office documents is somewhat non-trivial. In my experience, distiller does the best job. But PDFBox is certainly more straightforward if that will meet your print needs.
我们在我的工作中处于同一条船上,并且正在转向pdfbox。就其价值而言,为办公文档生成真正具有打印质量的 PDF(例如,由印刷公司打印的硬拷贝的 PDF)并非易事。根据我的经验,蒸馏器做得最好。但如果 PDFBox 能满足您的打印需求,它肯定会更直接。
回答by Xiang
You can use below three Java libraries to create HTML+CSS template to makeup your PDF file. Flying-saucer + Freemarker + Itext
您可以使用以下三个 Java 库来创建 HTML+CSS 模板来组成您的 PDF 文件。飞碟 + Freemarker + Itext
Flying-saucer:https://code.google.com/p/flying-saucer/
飞碟:https://code.google.com/p/flying-saucer/
Freemarker: http://freemarker.org/
自由标记: http://freemarker.org/
Itext 2.1.7: http://itextpdf.com/
(Please note this is the free version of iText in commercial projects.)
itext 2.1.7:(http://itextpdf.com/
请注意这是iText在商业项目中的免费版本。)
You can also Check this project which is using these three libraries:
您还可以检查这个使用这三个库的项目:
回答by Eelke
Personally I have used Apache FOPsupports several output formats. You might also be interested in JasperReportsit supports pdf, html, excel and openoffice.
我个人使用过Apache FOP支持多种输出格式。您可能还对JasperReports感兴趣,它支持 pdf、html、excel 和 openoffice。
回答by Mattias Isegran Bergander
回答by Tobold
iText wasn't always under AGPL. You might consider using iText 2.7 or 4.2 which are under LGPL.
iText 并不总是在 AGPL 之下。您可以考虑使用 LGPL 下的 iText 2.7 或 4.2。
See also this question: What is latest version of itext that is not AGPL?
另请参阅此问题:不是 AGPL 的最新版本的 itext 是什么?