Return to site

PDF generation using PLJRXML2PDF and Jasper iReports

An easy and free (no cost) way to generate template-based PDF documents with APEX

PDF generation using PLJRXML2PDF and Jasper iReports

In this Blog I share with you a way to generate PDF documents from APEX.
What I like of this approach is that is free (no cost), very easy and rock solid!

It is important to understand this is just "another way"... Some solutions are much more capable and robust, some are subscription based with many more features, etc..

Suggestions:

  1. Identify your requirements very clearly, you don't want to spend time with the wrong tool
  2. Understand the capabilities of each of the candidates tool
  3. Make sure your client understand that subscription based services have an ongoing cost
  4. Identify economies of scale to help the client choose if a license-based solution is the way to go

Now the story....

With APEX "out-of-the-box" you can print PDF documents, the problem is the features are somewhat basic and very easily the capabilities will not meet expectations or requirements.

From Oracle perspective the solution is in BI Publisher and that is probably the best solution but frankly speaking and in my opinion few customers will buy it given the pricing.

When I needed to produce a PDF containing pictures and to align to an existing template it was clear that out-of-the-box would not cut it...  so I started to investigate possible solutions..

  • Oracle BI Publisher was a no-go from the pricing perspective
  • Jasper Reports was a solid candidate but the product is a centralized report and analysis managed server (so its like BI Publisher, big and many moving parts)
    • I'm pretty sure there are licensing implications with Jasper Reports with commercial support and given that Tibco is behind all that I felt no need investigate further (Tibco is a very messy company for licencing and pricing - first hand experience)
  • Hosted Solutions were very capable and best price entry-point but my client explicitly asked for a non-subscription based solution.. 
  • I found PLJRXML2PDF which is a PL/SQL based solution, this one is free and just what I needed!

So if you happen to choose PLJRXML2PDF, what does it look like?

You will need the following components:

  1. Download iReports Designer (from Community JasperSoft)
  2. Download PLJRXML2PDF

Here's the high level description of the workflow:

  1. iReport is the application that creates a template using drag-drop features, preview, etc...
  2. Once the template is complete, generate the corresponding XML and load it in a table
  3. Then a PL/SQL call (part of the PLJRXML2PDF package) puts it all together to render the PDF for the application(s)

So, it's the best thing since sliced bread?

...not perfect but pretty darn good!

Pros:

  • Components are Open Source, free and easy to use
  • They’ve been on the market for years, they’re pretty stable

Cons:

  • No commercial support
  • Limited number of Fonts - but more can be added (I did not test this)
  • Limited languages and character set is UTF8
  • Limited chart types
  • iReports needs Java 1.7 (won’t work with 1.8) 

Goodies about PLJRXML2PDF:

  • It is installed by just importing the Demo application!
  • Many Demo reports
  • Load of pictures e.g. corporate Logo, XML (report) definitions, Fonts, etc. to the target table
  • Create an XML (report) of an existing APEX Report! (reverse-engineer a report)
  • Works fine with Oracle 11g (XE) and 12c as well with 
  • Works fine with APEX 4.x and 5.x

In a nutshell...

I recommend you try PLJRXML2PDF as a possible solution for your PDF generation

The time you spend in 'kicking the tires' is minimal and the fact that is PL/SQL based makes it portable to other environments.