Showing posts with label FOP. Show all posts
Showing posts with label FOP. Show all posts

Monday, June 25, 2012

Wanted to generate PDF and MS Excel Reports within Java application?


Do you want to develop a reporting capability within java based application? I have shared my knowledge/experience on reporting projects which I have worked earlier. Happy to hear if from you if you have any concerns/suggestions.

To work with PDF Reports:

We have used FOP and iText earlier (not both in a same project) to create a pdf report using Java. Please read the below for each of its pros and cons.

FOP:
It is an open source Java API to create a PDF report dynamically in a template format. If you have a XML data and formatting object template (xsl), creating PDF report using FOP is very easy.  I would say only 3 lines of code will help you to create a PDF report.

XSLFO is a XSL formatting objects and can be used for formatting XML data and to generate PDF report. Using FOP, it is easy for us to generate a read-only pdf. At the same time, we can’t alter an existing pdf or we can’t apply any security within a pdf using FOP. Want to know more? Have a look @ http://www.codeproject.com/Articles/37663/PDF-Geneartion-using-XSLFO-and-FOP

iText:

It is an open-source and more powerful java api for creating a PDF file using java. Using iText, developers can create a PDF file with digital signature and security (including having permission for opening a document, print/copy the pdf). In addition to that, we can manipulate, split and concatenate the existing PDF(s) within Java program. Also, we can build a form within PDF document. Good set of working examples are available @ http://itextpdf.com/

You can choose the right framework to address your pdf needs.


To work with Excel Reports:

We have used POI and JExcel earlier (not both in a same project) to create a Microsoft   xls (spread sheet) report using Java. Please read the below for each of its pros and cons.

POI:
It is an open source Java API to read/write/modify Excel spread sheets dynamically if you have a template already (xsl). Say implementing the POI will be very easy if you already have the xml data response and xsl template for your report. As I understand, POI is not improved as much like JExcel in terms of protecting the xls spread sheet data. Want to learn more, please look at http://poi.apache.org

JExcel:
It is an open source Java API to read/write/modify Excel spread sheets dynamically. If you want to apply security OR to derive a new data (Sum, average etc) using the existing data, JExcel will be the right option. It is a Java API, we wanted to write Java code for column alignment, font, style etc.  Also, it supports copying charts and images into excel sheet. Want to know more? Visit http://jexcelapi.sourceforge.net/

If you unable to follow the examples used in the above links, any issues or sample codes, reach put to me.

_NjN

Pega Decisioning Consultant - Mission Test Quiz & Answers

The Pega Certified Decisioning Consultant (PCDC) certification is for professionals participating in the design and development of a Pega ...