Here is my situation. I have written a Database application in Java. Now (unfortunately as an afterthought) I want to generate forms from data I pull from the database.
By form I mean a savable and printable file (not anything to do with UIs or swing). Basically I want to take a template form and fill in things from the data I pull from the database.
Is there any simple API for this? I really don't care about the file format, it just has to be savable and printable (pdf, word, open office, ect.). Forms have to be able to have differing fonts and possibly images though.
I looked at Apache POI for MS Word docs, and a few other APIs and these seem extremely painful.
Has anyone had a good experience with any particular API?
Thanks for your help!Answer1:
I would recommend iText because it gives you the functionality of writing Graphics2D to the PDF canvas, which means you can easily embed images and such in your form.
A minor issue with the library is that the best examples, I believe, are in the "iText in action" book by Bruno Lowagie (ISBN: 1932394796), which costs around 50 dollars US.
iText can have a rather steep learning curve, but for forms and such it should be fairly easy. Another advantage is that it can be used in combination with e.g. JFreeChart.
If you only want to fill out already generated PDF forms, iText is the way to go, since it has some great abstractions for doing exactly that.Answer2:
depending on your needs you can either use a reportgenerator like <a href="http://jasperforge.org/projects/jasperreports" rel="nofollow">jasperreports</a> or go for a pdf-library like <a href="http://itextpdf.com/" rel="nofollow">iText</a>Answer3:
<a href="http://www.docmosis.com" rel="nofollow noreferrer">Docmosis</a> is a good library as well for populating templates and outputting various formats. I have seen some places using both iText and Docmosis because each has strengths.Answer4:
Thanks for your help! I decided to go with a combination of iText and <a href="http://jexcelapi.sourceforge.net/" rel="nofollow">JXL</a> (an Excel API).