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:
- PS
- PCL
- AFP
- XML
- 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.
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.
data.xml
<?xml version="1.0"?>
<Students>
<Student>
<Name>Ishana</Name>
<Age>9</Age>
</Student>
<Student>
<Name>Ekagra</Name>
<Age>4</Age>
</Student>
<Student>
<Name>Ipsita</Name>
<Age>9</Age>
</Student>
<Student>
<Name>Akshit</Name>
<Age>3</Age>
</Student>
<Student>
<Name>Jiya</Name>
<Age>6</Age>
</Student>
</Students>
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.
No comments:
Post a Comment