Jermias,

Thanks for the input. I'll try the XML -> FO file -> PDF approach, but my
initial tests show that the FO file gets created without any issues and I
suspect the FO -> PDF conversion has issue.


Meanwhile, I was trying to get a little into the performance issue and I noticed
that the memory consumed by the java process almost spikes by 400-500 gig and
also seems that it does'nt get released after the transformation is completed.
This is how I base my observation :

The java batch process runs on a 2 CPU server which has about 8GB RAM. The heap
size was set to 1 gig. Before running the process, the java virtual memory was
showing around 600MB, and right after the FOP process started, the memory went
all the way up to 1.3 gig and stayed there. The process concatenates every 500
xml's into 1 PDF (the 500 XML's themseves are available as a concatenated XML).
I tried initially with 2000 XML's, which should have produced 4 PDF's. I enabled
Garbage collection on Websphere and kept track of it when the job ran. What I
saw was, the amount of memory GC was able to clear and make available was
getting reduced slowly say from 25% initially to all the way down to 0% and
eventually in the middle of the last PDF creation, the process got terminated. 

Each of these XML's have tables and are about 2-3 pages in size. It also uses
barcode4j.

Below is the transformation code :

FopFactory fopFactory = getFopFactory();

private void transformXMLToPDF(FopFactory fopFactory, Source src, Source xslt,
File pdf, File foFile 
throws FOPException, TransformerException, IOException
{
OutputStream out = new java.io.FileOutputStream(pdf);
out = new java.io.BufferedOutputStream(out);

             
try {
        Fop fop = getFop(fopFactory, out);
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer(xslt);
        transformer.setParameter("print-mode", "true");

        Result res = new SAXResult(fop.getDefaultHandler());
 
        transformer.transform(src, res);

        logger.im("Completed transformation!");
        fop = null;
} finally {
        out.close();
}

}
------------------------------------
private FopFactory getFopFactory()
{
        // configure fopFactory
        return FopFactory.newInstance();
}
        
private synchronized Fop getFop(FopFactory fopFactory, OutputStream out) throws
FOPException
{
                
        // configure foUserAgent 
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();

        return (Fop)fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
                
}  

I'm at FOP-0.92beta.

Please provide any suggestions. I'll work on the doing the process in 2 steps
and log my obervations.

Thanks
karthik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to