Jump to content
Changes to the Jaspersoft community edition download ×

image sometimes not displaying when printing


2004 IR Help

Recommended Posts

By: twr2 - twr2

image sometimes not displaying when printing

2004-10-24 21:31

from JRExtendedViewer.

 

Hi, I am including an image in a subreport. I can display this image in the viewer without problem. Sometimes when printing from the viewer, the image to be include will not show up on the paper. Is there anything I should look at that might be causing this? It doesn't seem to happen with precise predictablity.

 

Also, the reports being generated are around 10 pages each, where multiple reports can be generated at one time (Looping through a main report with several subreports). If I attempt to create more than n number of reports n*10 pages) at one time, I get a java.lang.Out of Memory exception. n in this case can be as few as 11 or as much as 115. It doesn't always happen at the same point.

 

Everything works fine when running say 10 reports (~100 pages) at one time. Anything above that, things might start to happen (image disappearing or out of memory error) Anything that I should look at for this?

 

Thanks a lot for any suggestions,

 

Twr2

 

 

 

 

By: anavarro - anavarrog

RE: image sometimes not displaying when printing

2005-07-07 02:01

Hello, I have the same problem. I have report of 48 pages, each one with the image of logotipo of the company. Single it visualized 7 pages to me with the logo and the others without the logo. This it is a problem of lack of memory, Out of Memory, of the JVM. Spent a time I discovered that the cause of this error is imagenes and its size. Change the size of the present logo, 350KB, to 23KB and the memory that occupied in the JVM reduced substantially. Even so, with report of many but pages (on 400) the problem would return to appear. I would like that somebody said a solution to me? it is important. Thanks

 

 

 

 

By: anavarro - anavarrog

RE: image sometimes not displaying when printing

2005-07-11 04:00

I have already found a solution to the problem. The solution is that a single image is loaded once and not like before, that is loaded whenever it must show. For it I have made the following changes in the JRImageLoader class:

We added the Imagenes variable that will be a Map with all the different images and already loaded.

 

private static HashMap Imagenes = new HashMap();

 

And we modified the method loadImage being of the following way:

 

public static Image loadImage(byte[] bytes)

{

/**Modificado por ANG */

if(Imagenes.get(bytes)!=null){

return (Image) Imagenes.get(bytes);

}

/******************/

Image image = Toolkit.getDefaultToolkit().createImage( bytes );

MediaTracker traker = new MediaTracker(new Panel());

traker.addImage(image, 0);

try

{

traker.waitForID(0);

 

}

catch (Exception e)

{

e.printStackTrace();

image = null;

}

/** Modificado por ANG****/

Imagenes.put(bytes,image);

/*********************/

return image;

}

 

I hope that it serves to him as aid to somebody. A greeting.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...