使用java从模板生成pdf文档的最佳方法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27702482/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 04:53:29  来源:igfitidea点击:

Best way to generate pdf documents from template with java

javatemplatespdf

提问by stegada

For my Java web application I would like to create pdf documents from templates.

对于我的 Java Web 应用程序,我想从模板创建 pdf 文档。

I need to add specific information (text formatted and tables) to the template and generate a pdf file.

我需要向模板添加特定信息(文本格式和表格)并生成一个 pdf 文件。

What are the available solutions?

有哪些可用的解决方案?

回答by Eugene Burtsev

You can try to use Birt Reportsor Jasper Reports. Both of these libraries supports pdf output.

您可以尝试使用Birt ReportsJasper Reports。这两个库都支持 pdf 输出。

回答by Bruno Lowagie

Use a tool such as Open Office or Acrobat to manually create a PDF that contains form fields (AcroForm technology). Then use a library to fill out the form fields in this template. See also Creating complex pdf using java, a question that was selected in the bundle The Best iText Questions on StackOverflow(a free ebook). You'll also find other options in this book, such as the options explained in the answer to this question: Generate and design PDF with iTextSharp or similar

使用 Open Office 或 Acrobat 等工具手动创建包含表单域的 PDF(AcroForm 技术)。然后使用库填写此模板中的表单字段。另请参阅使用 java 创建复杂的 pdf,这是在 StackOverflow 上的最佳 iText 问题(免费电子书)捆绑包中选择的问题。您还将在本书中找到其他选项,例如此问题的答案中解释的选项:使用 iTextSharp 或类似工具生成和设计 PDF