By: swami - shakai2k
Problem in adding images to a report
2002-11-13 20:50
I am trying to add a bunch of images dynamically, based upon blobs thats stored in my Oracle Database.
I created a DataSource that extends JRDataSource and the Object that it returns when it does a next is a java.awt.Image.
When i finally call the JasperRunManager to deliver the PDF File, the JasperRunManager takes a long time to return back the PDF File.
I did a profiling of whats going on and from the time my DataSource is called to the time my actually report is rendered, it takes nearly 20-25 seconds for the report to be rendered.
Can anyone please help me solve this delay in adding of images. Any help in solving this problem will be greatly appreciated.
Thanks
Swami
By: swami - shakai2k
RE: Problem in adding images to a report
2002-11-14 10:46
The problem is not how to pass the image into the Jasper Reports, the problem is, its taking a very long time to add the images in the report, regardless of whether i pass it as a stream or an awt.Image.
Each Image takes roughly around 6 seconds to be added to the PDF report, is there anyway i can reduce this time....
Any ideas with regards to this will be greatly helpful, thanks a lot for your help..
By: Raj - rajs1
RE: Problem in adding images to a report
2002-11-14 12:33
this is what I do:
...
<field name="TxtImg" class="java.io.InputStream"/>
...
<pageHeader>
<band height="150">
<elementGroup>
<image>
<reportElement x="0" y="0" width="81" height="81"/>
<imageExpression class="java.io.InputStream">$F{TxtImg}</imageExpression>
</image>
</elementGroup>
...
its connects to an IBM d/b (I have also tried Interbase) and it displays within seconds on JasperViewer
By: Raj - rajs1
RE: Problem in adding images to a report
2002-11-14 10:11
Try getting the Inputstream from the blob (blob.getInputStream()) and send that to the report.
Works for me.
Cheers
-raj
By: Teodor Danciu - teodord
RE: Problem in adding images to a report
2002-11-14 12:44
Hi,
The default JRResultSetDataSource implementation
should be able to handle blob fields if you declare
a filed of class InputStream and use this input
stream object in the <imageExpresssion>.
However, I doubt that this will increase speed.
How many images are on the report?
Thank you,
Teodor
By: swami - shakai2k
RE: Problem in adding images to a report
2002-11-14 15:14
Hi I have around 5-6 images in my blobs, let me tell you something else also, these are all tif images thats been stored, so i use JAI stuff to convert them from an Input Stream to an java.awt.Image (actually java.awt.image.BufferedImage). I pass these awt.Images into JasperReports.
Teodor,
In the JRImageLoader it seems you are creating a MediaTracker to add the actual images, it seems to be taking substantial amount of memory. Do we need to create a MediaTracker to handle this because iText takes a Image as an Object?
I may be wrong but I want to convey this also, since we are already passing an Instance of an Image Object in the DataSource I think it makes sense to handle this object into iText which will do the final rendering of the image.
Please refer to this link wherein i had posted comments on how I had converted TIF's into java.awt.Images?
http://sourceforge.net/forum/forum.php?thread_id=762199&forum_id=113529
Thanks a lot for your help guys.
Thank you
Swami
Problem in adding images to a report
2002-11-13 20:50
I am trying to add a bunch of images dynamically, based upon blobs thats stored in my Oracle Database.
I created a DataSource that extends JRDataSource and the Object that it returns when it does a next is a java.awt.Image.
When i finally call the JasperRunManager to deliver the PDF File, the JasperRunManager takes a long time to return back the PDF File.
I did a profiling of whats going on and from the time my DataSource is called to the time my actually report is rendered, it takes nearly 20-25 seconds for the report to be rendered.
Can anyone please help me solve this delay in adding of images. Any help in solving this problem will be greatly appreciated.
Thanks
Swami
By: swami - shakai2k
RE: Problem in adding images to a report
2002-11-14 10:46
The problem is not how to pass the image into the Jasper Reports, the problem is, its taking a very long time to add the images in the report, regardless of whether i pass it as a stream or an awt.Image.
Each Image takes roughly around 6 seconds to be added to the PDF report, is there anyway i can reduce this time....
Any ideas with regards to this will be greatly helpful, thanks a lot for your help..
By: Raj - rajs1
RE: Problem in adding images to a report
2002-11-14 12:33
this is what I do:
...
<field name="TxtImg" class="java.io.InputStream"/>
...
<pageHeader>
<band height="150">
<elementGroup>
<image>
<reportElement x="0" y="0" width="81" height="81"/>
<imageExpression class="java.io.InputStream">$F{TxtImg}</imageExpression>
</image>
</elementGroup>
...
its connects to an IBM d/b (I have also tried Interbase) and it displays within seconds on JasperViewer
By: Raj - rajs1
RE: Problem in adding images to a report
2002-11-14 10:11
Try getting the Inputstream from the blob (blob.getInputStream()) and send that to the report.
Works for me.
Cheers
-raj
By: Teodor Danciu - teodord
RE: Problem in adding images to a report
2002-11-14 12:44
Hi,
The default JRResultSetDataSource implementation
should be able to handle blob fields if you declare
a filed of class InputStream and use this input
stream object in the <imageExpresssion>.
However, I doubt that this will increase speed.
How many images are on the report?
Thank you,
Teodor
By: swami - shakai2k
RE: Problem in adding images to a report
2002-11-14 15:14
Hi I have around 5-6 images in my blobs, let me tell you something else also, these are all tif images thats been stored, so i use JAI stuff to convert them from an Input Stream to an java.awt.Image (actually java.awt.image.BufferedImage). I pass these awt.Images into JasperReports.
Teodor,
In the JRImageLoader it seems you are creating a MediaTracker to add the actual images, it seems to be taking substantial amount of memory. Do we need to create a MediaTracker to handle this because iText takes a Image as an Object?
I may be wrong but I want to convey this also, since we are already passing an Instance of an Image Object in the DataSource I think it makes sense to handle this object into iText which will do the final rendering of the image.
Please refer to this link wherein i had posted comments on how I had converted TIF's into java.awt.Images?
http://sourceforge.net/forum/forum.php?thread_id=762199&forum_id=113529
Thanks a lot for your help guys.
Thank you
Swami
0 Answers:
No answers yet