I want to display all page thumbnails. However I came across memory size
problem with PDFRenderer or PDDocument - I don't know which one.
I have the following code:
....
private PDDocument pdfDocument;
private PDFRenderer pdfRenderer;
public WritableImage getPageThumbImage(int page){
WritableImage result=null;
try {
BufferedImage bi=pdfRenderer.renderImageWithDPI(page, 12,
ImageType.RGB);
result=SwingFXUtils.toFXImage(bi, null);
} catch (IOException ex) {
....
}
return result;
}
.....
The method getPageThumbImage I run in for loop for every page.I set java memory
heap to 500mb.
And I can get about 30 images using getPageThumbImage (if I set more memory I
get more).
In my application I have real time memory graphs and they show that memory is
very fast filled.
When there is no more free memory getPageThumbImage hangs - no exception,
nothing. But the code stops.
When I do pdfDocument=null,pdfRenderer=null I get about 400mb free memory. How
to solve this problem?
--
Alex Sviridov