Can anyone suggest me how to create one pdf using multiple Apache fo objects?
We know that Apache fop generates pdf using FO(formatting objects). FO is created from xml by applying xsl.
My requirement is, I will be generating multi page pdf files. Each page template will be different, so I would need multiple xml and xsl files for one pdf. I thought of merging them and creating one FO but some PDF size would go till 2000 pages which leads to OutOfMemoryError
.
I went through the Apache FOP reference example files for creating one pdf using multiple fop but I could not find one.
An FO file you can contain as many fo:page-sequence
elements as you want or need, each one with its master-reference
property pointing to a page master.
So, you can have a single FO file with
fo:page-sequence
elements with the same page layout (think of the different chapters in a book)fo:page-sequence
each one with a different layoutBesides, FOP processes the content of each page fo:page-sequence
independently, so having many smaller page sequences instead of a giant one (if possible) also helps avoiding out-of-memory errors.