I tried to increase memory of JVM through Tomcat - but not much change. I believe the way i am using my procedure (creating objects) that might be wrong.
Below is some statistics (logger is displaying) when i am trying to render the PDF with 1 page / 2 pages / 3 pages etc
1 page report 2 pages report 3 pages report
Initial Heap size ~ 12M 14M 10M
Current Heap size ~ 64M 10M 9M
Total memory used ~ 52M 4M -1M
If i try for 4 pages report then i get OutOfMemory Error. Once i get this error then even sometimes i get errors for 2 pages / 3pages report too. Total memory used always go in -ve later.
I am attaching my procedure below which i use to render the pdf
----------------------------------------------------------
//Following method is used to render PDF
public synchronized void renderPDF (...)
throws Exception {
...
get xsl file path
....
public synchronized void renderPDF (...)
throws Exception {
...
get xsl file path
....
get xml
....
....
org.apache.fop.image.FopImageFactory.resetCache();
//get the user config file for pdf Arial unicode font
File userConfigFile = new File(cnffilepath);
Options options = new org.apache.fop.apps.Options(userConfigFile);
//get the user config file for pdf Arial unicode font
File userConfigFile = new File(cnffilepath);
Options options = new org.apache.fop.apps.Options(userConfigFile);
TraxInputHandler xsltinput = new TraxInputHandler(new File(xmlpath), new File(xslpath));
ByteArrayOutputStream outputPDFBuffer = new ByteArrayOutputStream();
Driver driver = new Driver();
driver.setLogger(new org.apache.avalon.framework.logger.Log4JLogger(logger) );
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(outputPDFBuffer);
xsltinput.run(driver);
FileOutputStream pdfDoc = new FileOutputStream(pdfpath);
pdfDoc.write(outputPDFBuffer.toByteArray(), 0, outputPDFBuffer.size());
pdfDoc.flush();
pdfDoc.close();
}//renderPDF
---------------------------------
ByteArrayOutputStream outputPDFBuffer = new ByteArrayOutputStream();
Driver driver = new Driver();
driver.setLogger(new org.apache.avalon.framework.logger.Log4JLogger(logger) );
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(outputPDFBuffer);
xsltinput.run(driver);
FileOutputStream pdfDoc = new FileOutputStream(pdfpath);
pdfDoc.write(outputPDFBuffer.toByteArray(), 0, outputPDFBuffer.size());
pdfDoc.flush();
pdfDoc.close();
}//renderPDF
---------------------------------
regards
Manisha
Chris Bowditch <[EMAIL PROTECTED]> wrote:
Manisha Sathe wrote:
> Thanks Chris,
>
> Would appreciate if u can explain more how shall i increase memory in my
> case ->
>
> I am on Tomcat server and using servlet to render the fop. I am not
> using fop.bat file, Which script starts my JVM - really speaking i also
> do not know.
Well I havent used Tomcat, but I know it will be started by a shell script or
batch file. You will need to find it and add the parameter -Xmx256M to the
call to java. Ask on a tomcat specific list, this is getting somewhat off
topic for FOP/XSL-FO.
Chris
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com