PDF Generation Library for Java [closed]

我只是一个虾纸丫 提交于 2019-11-27 06:33:43

Give JasperReports a try. Use iReport to create the .jrxml files. JapserReports can handle complex layouts. For those parts of the report based on different queries have a look at using subreports embedded into the main report.

Just like @Adrian Smith's solution this approach will separate the report layout editing from the data sourcing.

I have implemented a good solution where my software creates a format-independent "pure" XML file, then I give my boss the XSD and he puts it into Altova StyleVision where he can WYSIWYG design reports based on data he plucks out from the XSD. That software produces an XSLT. So my program:

  • Produces the format-independent "pure" XML
  • Transforms it with the XSLT, the output of which is XML-FO
  • Use Apache FOP to convert the XML-FO into PDF

This is a really great solution, means no more do I (as a programmer) have to change my code each time my boss wants to change a color in the report, my job is simply to produce "pure" XML.

Update: I should also point out that I give my boss access to our SVN repository with Tortoise SVN which is sufficiently easy to use that he can use it without error. So he can check the XSLT files straight into SVN and run the build/deploy without even having to interrupt me from my work. Obviously that workflow only works with people who are sufficiently exact that they don't make mistakes etc., but it works out well for us in that case.

Based on my experience, I would suggest you to consider following Java PDF Libraries for creating PDF reports,

  1. DynamicReports
  2. Apache PDF Box
  3. iText PDF
  4. PDF Clown

For your requirement, I think DynamicReports would be the right choice. I have been using Dynamic Reports from last 3 years for all my PDF Reporting requirements. With a very less amount of code, you can easily create a truly dynamic PDF. Dynamicreports is a wrapper around Jasper Report. So, it internally makes use of Jasper report.

Docmosis allows you to create templates in Word or OpenOffice writer - separating concerns nicely and layout is then in the most familiar tools.

I have been using JODConverter for a while and I really like it.

What we do is use JODReports to generate dynamic OpenOffice.org documents (which internally uses FreeMarker). Then we convert these documents to PDF documents using JODConverter.

It sounds like a lot of work, but it really isn't.

One possibility is

  • to create your documents in PostScript format and then
  • convert it to pdf using ghostscript (ps2pdf)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!