Jump to content
We've recently updated our Privacy Statement, available here ×

Does isUsingCache work for images in subreports?


stelek

Recommended Posts

Hi,

I have the following configuration of reports/subreports"

  • main
    • subreport
      • subsubreport A
      • subsubreport B

"subsubreport A" contains an image. Since A appears thousands of times in the main report, the image also appears thousands of times. Because of that, the PDF file size grows a lot (from 5MB without image to 330 MB with image). I wanted to try to have the image only once in the final PDF, so I turned on the "isUsingCache" option for the image in subsubreport A.

The result is that:

  • the file size was not reduced at all
  • the memory usage during report generation went up a lot (to a point where I had to limit my source data or I was running out of memory even though I'm using a virtualizer)

So my question is: is the "image caching" mechanism supposed to work across subreports and if so, how can I achieve that? Or maybe there's some other way to remove duplicate images (eg. during exporting to PDF)?

Thanx in advance for any help.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

OK, I managed to solve it myself. The issue was not with the "subreport structure" but with the fact that I was using java.awt.Image as the image source. Unfortunately the Image object was not static - instead a new instance was created each time. JR was not able to recognize that the Image objects were actually identical and was not caching it. I changed the scriptlet to contain a static object and now the caching works :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...