Hi:
I know it's a old issue and there are many postings in this regard. Still,
some more light is required, that led to this question.
We are using FOP 0.92 for converting a XSL:FO document to PDF/RTF etc. Since
there is a table with many rows with data coming from a huge db table, it is
causing OutOfMemoryError.
We split up the document with single fo:root but multiple page-sequences
with each page-sequence having a finite number of fo components, still we
come up with OutOfMemoryError, and also, after the OutOfMemoryError comes,
the amount of free memory does not move up to the level where the
transformation is started.
Our approach is in line of the documented standards:
i.e.
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.MimeConstants;
/*..*/
// Step 1: Construct a FopFactory
// (reuse if you plan to render multiple documents!)
FopFactory fopFactory = FopFactory.newInstance();
// Step 2: Set up output stream.
// Note: Using BufferedOutputStream for performance reasons (helpful with
FileOutputStreams).
OutputStream out = new BufferedOutputStream(new FileOutputStream(new
File("C:/Temp/myfile.pdf")));
try {
// Step 3: Construct fop with desired output format
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
// Step 4: Setup JAXP using identity transformer
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(); // identity
transformer
// Step 5: Setup input and output for XSLT transformation
// Setup input stream
Source src = new StreamSource(new File("C:/Temp/myfile.fo"));
// Resulting SAX events (the generated FO) must be piped through to FOP
Result res = new SAXResult(fop.getDefaultHandler());
// Step 6: Start XSLT transformation and FOP processing
transformer.transform(src, res);
} finally {
//Clean-up
out.close();
}
After we hit out.close, does it cleanup all used up resources or should we
do something extra to cleanup?
Also, is there any guideline that how many page-sequences a document can
have and also within one page-sequence how much (how do we know how much) so
as to handle large volume? I know it depends on the amount of free memory at
the time of spawning this transform request, but still, a guildeline would
help so that I can split into page-sequences accordingly.
Also, is it always true that a new page-sequence starts with a new page
break as well? Or can we continue in the same page just like a logical page
break kind of.
Please help.
Regards,
Debasish Jana
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]