Elvis Novas wrote:
Hi All,
I’m generating a Book (PDF file) using Java. The book is made of several existent pdf files (mostly images) as pages and when this book reaches a significant amount of MBs I’m running out memory. Checking the process using OptimizeIt in JBuilder I’m noticing that PDFReader is not “garbage collecting” this object causing the application to hang because of the memory problem. If Increase the memory I’m able to finish the process but I don’t think that should be the solution since we consider that what the JVM has now is good enough. By the way, the size of the last book (it varies based on different business needs) 96 MB.
The following is the approach I taking (not actual code):
Document mainDocument = new Document(PageSize.LETTER, 36, 36, 36, 36);
FileOutputStream book = new FileOutputStream(outputFile);
PdfCopy pdfCopy = new PdfCopy(mainDocument, book);
mainDocument.open();
Execute the loop _content_ (the next 3 lines) in separate method
PdfReader pdfReader = new PdfReader(currentPdfFile); ==è here’s
where OptimizeIt is showing the memory leak.
PdfImportedPage importedPage = pdfCopy.getImportedPage(pdfReader,
1);
pdfCopy.addPage(importedPage);
Regards
Stephan
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions