Scope creep; it'll get you every time.
An important part of the system that I'm currently working on is a financial statement. This needs to be printable, and to look good when printed. To begin with, I was confident that CSS styled HTML would do the necessary. But now I find that we need this statement to look exactly the same as the paper one that users currently get, including things like fonts and the location of page breaks. Also, the client now wants cross referencing; "See page 12 for a breakdown", that kind of thing. So, HTML ain't gonna cut it, CSS or no CSS. Sigh.
Naturally at this point, we looked at PDF. We can do all the above and more with PDF. But how to generate it?
Generating PDF is nothing like generating HTML. It's a binary format with all sorts of indexing and cross referencing. You can't just use a template tool like JSP or Velocity. (In fact, it's a sort of wrapped and compressed Postscript. Postscript is actually an executable format.) So, we need a tool to generate our PDF for us. (The tool doesn't have to be for Java/J2EE, though that would help.)
Naturally, I looked at Reportlab. Their RML2PDF tool is exactly what we are looking for; we could easily generate the required RML (an XML dialect) file from a JSP. But, look at the price! RML2PDF is simply way beyond our budget. Sorry, Andy. :-(
Some of the other commercial offerings are rather a lot cheaper. Style Report, for instance, can be driven from Java objects or direct from SQL, and includes a JSP taglib, so it would fit right into our current architecture. Mark is evaluating tis product, along with ReportMill, Formula One e.Report and Crystal Reports. If anyone has used any of these, please let us know how it went!
On the OSS front, iText looked promising, but we aren't allowed GPL software on our products. (No, not even LGPL software; its meaning is ambiguous in the context of a Java application, and we don't intend taking any risks.) The other OSS tools either had the same license issues, or were at too low a level, or both.
So, what does everyone else use?
Posted to Java by Simon Brunning at February 12, 2004 03:06 PMWe used root river delta (www.rrsys.com) for this. Did everything we wanted.
HTH
Fokko
Thank's Fokko, I'll go look it up....
Posted by: Mark Matthews on February 12, 2004 03:50 PMWe used XSLT and FOP but found that the XSLT style sheets for a simple report had to be 100's of pages long. I'd suggest looking into it, but for complex reports, it might not be possible.
another XSLT/FOP user here. The XSLT stylesheets can be pretty big, but they got the job done. It's available from http://xml.apache.org. I don't know much about OSS licenses, but I don't think the apache license is strictly (L)GPL, so you might still be okay.
Posted by: inignot on February 12, 2004 04:07 PMApache style licenses are fine; we are using loads of Apache stuff.
XSLT/FOP looks cool. We'll look into it.
Posted by: Simon Brunning on February 12, 2004 04:13 PMiText is licensed also on MPL licence, which is perfect for a commercial use.
The MPL looked a bit LGPL-like to me, but IANAL. Anyone know where I can find an explaination of the MPL license for mere mortals?
Posted by: Simon Brunning on February 12, 2004 04:52 PMin commercial front, probably the strongest is Bigfaceless. superb pdf report and chart generation.
http://big.faceless.org/
combinin with velocity, pdf's can be produced rather easy. it uses an HTML like system for producing them.
How about JasperReports? Its available under the apache license (http://jasperreports.sourceforge.net/).
Posted by: sam on February 12, 2004 05:13 PMOne suggestion I made early on: perhaps we should look at <holds-nose>generating MS Word documents, and using Distiller to create PDF from *them*.</holds-nose>
I feel dirty now.
How would you generate word docs from Java? Of course, doing it from Python is easy, using ActiveX.
Posted by: Alan Green on February 13, 2004 01:08 AMWe use Formula One in our current project. It is very hard to get a goot looking report out of that Mother. You have to learn the internal (not documented) xml slang to do that. Otherwise you are limited to a poorly coded designer program that generates the templates for you. Also, I think it is overpriced.
Posted by: tag on February 13, 2004 09:05 AMJasperReports uses iText, so if you don't like the MPL, you have the same problem. BTW the license of iText was changed from LGPL to MPL (with LGPL as alternative for backwarts compatibility) on demand of companies that didn't want to work with LGPL'ed libraries. MPL was fine for them, so that was what we eventually took as license. We don't intend to change it into something else in the near future.
Posted by: Bruno on February 13, 2004 09:23 AMAlan,
Python, eh? Hmmm, I'd not thought of that. ;-)
In fact, there are COM bridges available to Java; JCom[1], for instance. Or, you could use Jakarta POI[2], or perhaps even generate Word new XML format file, (though I've never seen one).
Naturally, I'd *rather* do it in Python, if we do it at all. But since none of us trust Word to do what we need in a reliable and timely fashion anyway, the point is moot.
[1] http://www.hcn.zaq.ne.jp/no-ji/jcom/index_eng.htm
[2] http://jakarta.apache.org/poi/
Bruno,
The MPL *may* be OK for us, too. It's just that I don't understand its implications, so I don't know! If someone could give me a plain English interpretation, I'd be grateful.
Either way, iText looks like a fine package - thanks for contributing to the greater good, Bruno.
Posted by: Simon Brunning on February 13, 2004 09:36 AMHaving done the XSL-FO route with Apache FOP, I would advocate looking into a commercial XSLFO implementation (RenderX XEP is very high quality). Don't bother with XSLT, its just an unnecessary pain.
Posted by: hemisfear on February 13, 2004 07:32 PM> But now I find that we need this statement to look exactly the same as the paper one that users currently get, including things like fonts and the location of page breaks.
Adobe InDesign can be automated via JavaScript, VB (Windows) and/or AppleScript* (Mac). (Can't vouch for ID/Windows, but I've done a little ID scripting on the Mac and it looks good to me.) Bonus: as well as generating PDF files, an ID-based solution could also produce press-ready files for no extra effort. Worth exploring.
http://www.adobe.com/products/indesign/scripting.html
--
* Or any other language that can send Apple events - Perl and Python are just about viable now; see Mac::Glue and appscript** respectively.
** Shameless self-plug. ;)
Posted by: has on February 13, 2004 10:57 PMI used iText for exactly the same reason you are describing. We had to generate statements that looked exactly like the existing paper statements. After about a days experimentation we realised that we could do everything we needed to. Within a couple more, the statements were complete. It worked fantastically for us.
Posted by: Marty Andrews on February 14, 2004 12:31 PMI've heard someone else say that they used Velocity to generate RTF (Rich Text Format - which is apparently a plaintext format). Not sure whether they converted the RTF to PDF, but I'm sure there are tools to do that.
Sounds easier than using XSL.
Posted by: Joel Hockey on February 16, 2004 02:30 AMI use pdflib. it's great.
Posted by: Robert Sayre on February 17, 2004 04:08 PMI justed stumbled upon tiny-rml2pdf (http://openreport.org/index.py/trml2pdf); it's python, an looks promising; didn't tried it, but surely will
Posted by: Sascha Ottolski on March 30, 2004 06:11 PMHey --do v have any means to print a doc,pdf--i mean almost all the print formats in java--if so plz do gimme the code--
thanx in advance