Monday, December 29, 2014

Apache FOP Tutorial Part 1

FOP stands for Formatting Object processor. It's a java library which can read a formatting object (FO) tree and output the results in different formats. The output format supported are:
  • PDF
  • PS
  • PCL
  • AFP
  • XML
  • Print
  • AWT
  • PNG
And to some extent RTF and TXT. PDF is the primary output format supported by Apache FOP. Apache FOP is an alternative to iText for generating different formats.

The flow to generate a report using Apache FOP invloves using a data file in XML format. Then a XSLT style sheet is applied to generate the XSL-FO tree. The XSL-FO tree will be fed into the Apache FOP and will generate a PDF file as an output. 

Let's look into an example of how to generate a PDF file using Apache FOP

To start with let's look into the data file that we will use. Eventually the data of this file will be rendered in a pdf.


<?xml version="1.0"?>

It's a XML file containing a list of students which we will use to render on a PDF file. It contains a list of students with Name and Age. 

                                                                                                                                         >>>> Part 2

No comments:

Post a Comment