I am working on generating PDF from Java. I explored (in theory) the following options:
Pro: easy, with designer support, report tools (diagrams, cross-tables)
Con: page design may be limited, some may be database oriented, can be overkill if document is simple (Jasper report has huge documentation and features including database query etc.) Also Jasper still uses iText to generate PDF, which may not be free and license issue seems to be complicated
Apache PDFBox is very low level API for creating PDF. It requires familiar with PDF standard. Even so the API lacks support of table, etc. (of course can draw table out)
Positive comments are found on Internet about this approach. Also XSL-FO simply focuses on formatting page thus simpler than reporting tools (dealing with data source, diagrams, etc.).
XSL-FO does not deal with translation. To translate something into XSL-FO:
Con: it seems lack a free designer for XSL-FO.
An article talking about XSL-FO lead me to CSS Paged Media. However this solution is not as talked about as XSL-FO.
Header / Footer example (tested with : https://github.com/danfickle/openhtmltopdf)
Available libraries:
Pro: easier to find HTML composer tools than XSL-FO (BlueGriffon as start, or even office convert to HTML). Someone said O'Reilly moved its publishing platform from XSL-FO to XHTML & CSS. Someone's idea is that this is the future.
Con: Not big name (Apache) free libraries out there. Yes there are expensive commercial libraries out there and someone concerned vendor lock in. So far I spent a whole morning and only find this (for free) https://github.com/danfickle/openhtmltopdf. It seems descent to complete a simple job, though. And flying saucer library (but flying saucer uses iText library to render PDF so not good)
Read:
https://www.w3.org/TR/2011/REC-CSS2-20110607/page.html#the-page