PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) General questions / FAQ PDF with large number of Images.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #26684


    We have a requirement in our project to generate a pdf report with the list of some data and each data entry has an image associated with it.

    When we try to generate a PDF from HTML using the PD4ml library with say 1000 data objects with each data entry having an image of size 50 KB, then we start running out of Heap memory with the below mentioned trace.

    <br /> Exception in thread "Image Fetcher 2" java.lang.OutOfMemoryError: Java heap space<br /> at java.awt.image.DataBufferInt.<init>(Unknown Source)<br /> at java.awt.image.Raster.createPackedRaster(Unknown Source)<br /> at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)<br /> at sun.awt.image.ImageRepresentation.createBufferedImage(Unknown Source)<br /> at sun.awt.image.ImageRepresentation.setPixels(Unknown Source)<br /> at sun.awt.image.ImageDecoder.setPixels(Unknown Source)<br /> at sun.awt.image.JPEGImageDecoder.sendPixels(Unknown Source)<br /> at sun.awt.image.JPEGImageDecoder.readImage(Native Method)<br /> at sun.awt.image.JPEGImageDecoder.produceImage(Unknown Source)<br /> at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)<br /> at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)<br /> at sun.awt.image.ImageFetcher.run(Unknown Source)<br /> <br />

    I have my JVM Max heap configured to 1GB. Is there some way we can handle such large number of images in PDF report without exhausting the Heap.



    In theory, PD4ML should embed JPEG images to PDF “as is”, without a rendering in RAM. So the issue needs some investigations.

    But first, I would try to unload the images from RAM to the temp dir:
    [language=java:3p5iyqg7]Map m = new HashMap();
    m.put(PD4Constants.PD4ML_CACHE_IMAGES_IN_TMP_DIR, “true”);

    Does it change anything in your case?

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘General questions / FAQ’ is closed to new topics and replies.