using JasperReports’ JRXML for creating non-report documents (esp. PDF)


.jrxml” is the file extension of the XML files, that JasperReports’ GUI builder iReport deals with. The “compiled” resp. packed versions of them are then called “.jasper“. Actually the top element of that XML is called “jasperReport“. But let’s call these files and the XML “JRXML“!

The original purpose of JasperReports is to fill an output document with lots of records from an database query (an SQL “select” statement) in a formatted way, this kind of output document is called “report“.

Now at some stage lots of years ago developers discovered that JRXML and the JasperReports production chain can also be used to create all sorts of PDF files, not just reports from database queries. That’s what I referred to in the title as “non-report documents“.

I have no idea, why I cannot find anything on the web regarding this topic. I already have my second well-paid project with exactly this topic. So it must be a topic.

During my 1st project I pursued a couple of approaches:

  • I created a minimal XML with the most important attributes of JRXML, embedded in a Ruby template mechanism (ERB) – the code is not valid XML, and does not display well in Emacs’s nxml-mode
  • I used Perl subroutines as a macro mechanism to create JRXML, the XML tags with their attributes get coded in Perl as literal hash arrays – that’s the more powerful and best readable approach (IMHO) – I still do little experiments in iReport (of course) – but the code definitely gets maintained as Perl

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: