Hi,

I'm trying to generate a fairly large PDF file (40 pages) containing
multiple page sequences, the longest of which is 14 pages. Each page
sequence is basically a table, so naturally a lot of memory is being used up
by FOP when the page sequence reaches 14 pages. I am using version
0.20.5rc2.

What I have found is that my document generates successfully if I only
create it once; however, what I was originally trying to do was find out the
total number of pages across all page sequences, therefore I was creating
the document twice and taking the page count from the driver after the first
pass. When I use this "two pass" technique, I find that I get an
OutOfMemoryError. I tried increasing my JVM memory to 256MB, which is the
size of the RAM on my machine, but still get the same problem.

I have read the posts about tables taking up a lot of memory; but can anyone
explain why it works fine with one pass but fails with two passes? Is the
original document being held in memory while the new one is being created?
If so, is this necessary and is there anything I can do in my code to
prevent this? My code is as follows:

        // First pass
        driver = new Driver();
        driver.setOutputStream(new FileOutputStream(pdfFile));
                driver.setRenderer(Driver.RENDER_PDF);

 
transformer=TransformerFactory.newInstance().newTransformer(new
StreamSource(xslFile));
                transformer.setParameter("page-count","#");
                transformer.transform(new StreamSource(xmlFile), new
SAXResult(driver.getContentHandler()));
 
pageCount=Integer.toString(driver.getResults().getPageCount());
  
        // Second pass
        driver = new Driver();
        driver.setOutputStream(new FileOutputStream(pdfFile));
        driver.setRenderer(Driver.RENDER_PDF);
        transformer=TransformerFactory.newInstance().newTransformer(new
StreamSource(xslFile));
                transformer.setParameter("page-count",pageCount);
                transformer.transform(new StreamSource(xmlFile), new
SAXResult(driver.getContentHandler()));

I have read the other suggestions about splitting tables up etc, but this
would be difficult given the nature of my document. I would prefer to find a
solution that doesn't involve splitting tables if possible.

Any help greatly appreciated.

Regards,

Haitham.


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

Reply via email to