I am trying to explore Apche FOP library to create PDF documents and gone through all the examples.
In my application, we query database and get the value objects (java beans) and out of this we need to create PDF files. I looked at ExampleJavatoPDF, for me it looks too much of code (with SAXSource). I was thinking to use JAXB annotations (jaxb is shipped with JDK1.6) and generate XML stream on the fly and apply XSL to generate PDF.
The code looks as below.
It works fine. My question is, is it best practice to generate PDF files from Java Objects? Is there a better way? Can we generate XSL-FO from Java objects?
Thanks in advance.