JasperReports as a generic document generation tool - java

I need some input if this is possible.
I guess most of you who have used JasperReports use it to - obviously - generate reports.
My question is, can you use it to generate generic documents? Ergo, documents that AREN'T reports. Say, for example, an automated letter of authority with fields you can just populate at run time. Or a company form that is filled up by your app then generates a pdf using JasperReports.
The only other solution that came up was iText, which I believe is far more capable of achieving the desired output.
Any inputs would be appreciated. Thanks.

You could, but I wouldn't--IMO you're better off using raw iText, or one of the dynamic languge PDF generators. IIRC iText can fill in PDF forms, too, so if you have someone else creating the PDFs, they can just be populated via iText.
OTOH, if they're relatively simple, it probably doesn't matter very much--you can pass non-tabular data to JR, I'm just not sure it's any easier that way.

I do all kinds of elaborate reports with iReport. It is an amazing designer for JasperReports. It allows to drag and drop components and connect to your DB or JavaBean Datasources with wizards. A very mature application that gives you all sorts of report exporting capabilities.

With iText you can do anything. But it is a programming API and so you either have to create your own design tool or construct the reports in code. For something simple or that will rarely change, it works well.
If you want a full-blown docgen solution, you need a product like Document Science, Thunderhead, or Windward Docgen (disclaimer, I'm the CTO at Windward). The beauty of these solutions is you design templates (in the case of Windward you design in Word) that are then passed to the system so it does not require programming to create/revise a document. And they output to pretty much any format.

Related

How to generate a PDF output from a template PDF using something other than iText?

I'm working on a small Scala/Java prototype where I have several PDF templates i.e. they have text and image placeholders and the placeholders should be replaced with some content. Some sections are also multiple i.e. the actual number of occurrences or repetitions depends on the input. Then finally I need to generate and append an extra PDF page.
I'm aware that these use-cases can be covered using iText. My question is whether I can use an alternative solution for this (and how to do it). I'd prefer to avoid commercial solutions for the time being.
UPDATE: I'd like my PDF templates to be created by professional designers. They will know where the placeholders will be but should have full control on the design aspects. This requirement discards solutions based solely on XML inputs or others where the PDF is created fully programmatically.
Jasper - It's sofrware designed for crating dynamic reports connected with database inputs, but I think it can be utilized in the way you want. Has a graphical designer (either iReport or JaspersoftStudio based on your preferences), supports passing multiple variables with content or even images. Long static formatted texts may be a problem, but you will have to judge that for yourself.
JODReports + JODConverter - those two tools will allow your designers to work in pure ODT (OpenOffice format) files putting in dynamic data as variables that you will be able to substitute to your hearts desires from your Java code and print the output in PDF format. More than that, thanks to Java UNO API you can seize full control over the way your template looks and behaves if your inserted texts are really complex (though admittedly it's not intuitive to use).

Is it possible to fill templates (.xls, .pdf, ppt) with Birt or alternatives?

is it possible to fill a predefined template file via birt reporting?
.xls for exmaple: The template should have defined the column headers (nicly formatted) and some other stuff like the date of creation, the user, some legal notice, ...
.pdf on the other hand should define id-fields that are to be filled with data
.ppt as the last and may be trickiest one should ideally be also be useable as .pdf but as far as I know .ppt itself does not provide IDs for its fields and therefore a workaround must be used to identify the places to be filled
Are there alternatives to birt that might be able to do that?
I'm very curious about the answers :-)
Thanks a lot!
Templater supports docx and xlsx. From there we are generating PDFs using LibreOffice.
Being author of the tool, I highly recommend it :)
There are plenty of examples on site if you are interested.
It could be very challenging to hit a predifined Excle format with the native BIRT Excel emitter, there are several after market Excel emitters that might help you get there.
The easier way is to set up your BIRT report to export with the format you want, then save report and use it as foundation for recreating the next report. You can use grids, and master pages to get just the layout you want, then plug in report pieces.
You can also use the library to save grids, tables & data sets that you use over and over.
The Spudsoft XLS Emitter for BIRT (which is builtin with BIRT 4.3.1) supports this for XLS.
We are using this feature and it works like a charm.
However, BIRT does not support "filling" doc or ppt docs.
Templating engines usually have difficulties to support master-detail (or master-detail-detail) relationships. This is due to the somewhat stupid implementation of tables in MS Word.

Templated correspondence generation using Java

I am looking for a way to create pixel perfect, paginated, styled correspondence in a Java web application.
The requirements for this functionality are
- Ability to define outer/ master template with header/ footer/ logo etc...
- Ability to define inner content template where specific variables/ fields can be substituted with instance values at run time - e.g. employeeName. employeeAddress. The content template would be defined online using rich text editor or something similar
- Supports tables/ list
I believe iText does most/ if not all. Other options that I have considered is BIRT. Are there other/ better choices for this purpose?
Thanks
I have done something like with iText, although our case did not use an online text editor (we had a small number of templates and they were defined as part of the development cycle)
[Note: We did this under an older version of iText when it was still LGPL rather than Affero GPL]
The results were excellent, but in order to get it pixel-perfect we had to do a lot of work ourselves. We did manual layout and pagination - including manual text wrapping, etc. The layout tools that iText provides looked good, but they didn't give us the pixel-perfect control that we needed for the use case we had.
Have a look at iReport.

what does a tool like Jasper Reports/report generator gives me?

Ok, So I have to generate very complex reports from my DB.
If I am to do it with SQL the query themselves will be complex, and I will have to do some more manipulation on the results later, code level.
How do libraries like Jasper Reports/ Crystal Reports and friends save me time when developing such reports?
What will they give me?
These tools may not necessarily save you that much time writing the SQL, but they will give you a nice clean presentation of the data for your customers.
When it comes to writing the query, they won't give you much. Some of the Business Intelligence tools out there (although none of the open source ones I know of) give you infrastructure for point and click queries. A developer still has to do the hard work of setting them up, especially for complex queries, to provide a view of the data that is simple enough for the user.
What these tools do give you is an engine to take care of a lot of the presentation issues, such as formatting, page breaks, converting to multiple formats (HTML, PDF, etc), running, storing and retrieving the reports and other things in that area.
What ever tool you are using to generate reports, you got to write your complex SQL or define the views out of your data to generate the reports. The benefit of using the tools is
Can generate multiple type of report formats (PDF, EXCEL, TEXT..)
Eliminates a lot of routine chores like setting date/time stamps, header formatting..
Maintains consistency across multiple report pages which is generally a bit hard to acheive
Creates a template layout which can be reused and some fancy functions like sub reports and easy type conversions in some cases..
etc...
If I am to do it with SQL the query themselves will be complex, and I will have to do some more manipulation on the results later, code level.
Jasper could be very effective in manipulating the data before/during generating the report. By design, every variable, parameter or field in JasperReports could be a Java expression, imagine the possibilities.
How do libraries like Jasper Reports/ Crystal Reports and friends save me time when developing such reports?
Both Jasper and Crystal give you the ability to extract the fields from the query, Jasper also gives you abilities like extracting fields from XML or JavaBeans. (i dont know about Crystal)
What will they give me?
Those two are very good tools for making reports, i have made very complicated reports on Jasper, so the tools themselves are very advanced, its how you will use them that counts.
As others have said, what these tools give you is an link between your data and how you want to display it - be that a listing, chart, cross tab (grid of summarized values) etc, with options for your own parameters, calculations and queries.
If you are embedding your reports in your application, I'd say your selection of a reporting platform gets down to what technology are you comfortable with. For Microsoft, look at Crystal. For Java, look at JasperReports and iReport.
JasperReports does have sub reports.
Sherman
Jaspersoft (company behind JasperReports)
If you mean complex as in the data and manipulation, then code-level systems like Jasper and Docmosis will let you manipulate the data in code as well as in the query. You can combine the best of SQL with the best of code algorithms to get your report data ready. This will save you time if maintaining simple SQL + simple code is better in your environment than maintaining complex SQL.
It depends on your company and your skills. If you're in a small environment where you control everything, have access to anything, can download and install whatever you want, and you are a programmer and Reporting is more of an annoyance, Jasper has a lot of options. You need to do the hard work yourself, but you have the capabilities to do it.
But if you are in a company, like many people are, where the DBA controls the database, the SysAdmin controls the servers, you can't download and install whatever you want, things need to be checked in, tested, approved, etc, Reporting is something people need now, not after you figure out a way to code something that Jasper Doesn't offer, and your job is more a part of Reporting and Analysis over programming, then Jasper is a horrible tool.
Plus, like it or not, the other tools have far more support and help. Jasper is a bit useless when it comes to simple help. Search all the Jasper Forums. Look at any other forum about Jasper. Most questions go unanswered. And if you post something, it's very likely your question will never be answered. Or the answer isn't close to what you need.
It's a double edged sword. Jasper gives you a lot of freedom, but a lot of it is a bad tool to use for the real corporate world. Unless you have a job where you don't do much all day, Jasper takes too long for simple things to get done. If it's about getting reports to the right people at the right time, stay away from Jasper. Nobody really has the time or understanding to sit and figure out a work around and write up some code if a report needs to be done yesterday. End users don't care. It's the age old problem. It's built for techies, not for users. And the Reporting world is more about the users than the techies.
It's hard to say with the not so detailed info you provided, but I have 14 years experience with Crystal Reports and can tell you that it's very powerful. You can manipulate the resulting dataset in Crystal Reports in many ways. Crystal Report has a very decent internal program language to do this. And then you'll have subreports, which will save your day if it get hard.
I never found a report builder that can math Crystal Reports, especially looking at it's low price. If money isn't the problem then you can also look at List & Labels, www.combit.net.
One major thing Crystal Reports gives you is the ability to do Subreports--that is, multiple, related queries that return nested result sets. This can really simplify the individual queries your write. Take a look at http://vb.net-informations.com/crystal-report/vb.net_crystal_report_subreport.htm

Design PDF template and populate data at runtime using java,xml etc

well i have been looking for a java based PDF solutions...we dont have a clean way i guess-still.. all solutions are primitive and kind of workarounds... No easy solution for this requirement -
1. Designing a PDF template using a IDE (eg. Livecycle designer ..which is not free)
2. Then at runtime using java, populate data into this PDF template...either using xml or other datasources...
such a simple requirement and NONE has a good "open-source and free" solution yet ! Is anyone aware of any ? I have been searching for since 3-4 years now..for a clean way out...
Eclipse BIRT comes close.. but does not handle Barcode elements ..OOB.
Jasper - ireport is also good but that tool does not have a table concept and is kind of annoying ! Also barcode support is not good.
XSL-FO has not free IDE for design .
Looking for a better answer .. got one ?
If it's a "simple requirement", you could create a report designer around iText and release it as FOSS yourself.
What are your key requirements? Does your input have to be a PDF? If so, you'll be probably working uphill for a long time still. Obviously you want to inject data and output a PDF.
If your templates can be something other than PDF, you could try using the OpenOffice API to get OpenOffice to do manipulate documents and produce a PDF. JODReports or Docmosis would be better ways of interacting with OpenOffice and Docmosis allows you to treat documents (doc and odt) as templates.
You can create a PDF file with AcroField through iText API AcroField values can be populated.
Note: Using OpenOffice you can create PDF document with FormFields.
http://blog.rubypdf.com/2007/08/01/freely-fill-pdf-form-with-the-help-of-itext-or-itextsharp/
You could use OpenOffice's UNO API. It looks rather heavyweight but at least you get something full-featured.
Have a look at XDocReport. You create your templates in word .docx or OpenOffice .odt files, then turn them into populated PDF files with Java code.

Categories