Jump to content

problem when passing image as java.awt.Image

2005 IR Help

Recommended Posts

By: Lokesh Javaji - ljavaji

problem when passing image as java.awt.Image

2004-01-07 06:30


. I put a Image elemente on the page header, that element shows a image that I?m passing by parameter to the report as inputStream. The error ocurr when the report shows more than one page. See it:


dori.jasper.engine.JRException: Error generating PDF report : client


nested exception:


java.io.IOException: java.awt.Image fetch aborted or errored

So i tried creating an java.awt.Image object from the inpuStream and the passing it the the ImageElement and have set the image Expression Class to java.awt.Image. but it throws me the following exception


java.lang.IllegalArgumentException: Width (-1) and height (240) cannot be <= 0

at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)

at java.awt.image.BufferedImage.<init>(Unknown Source)

at dori.jasper.engine.util.JRImageLoader.loadImageDataFromAWTImage(JRImageLoader.java:222)

at dori.jasper.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:352)

at dori.jasper.engine.fill.JRFillImage.evaluate(JRFillImage.java:327)

at dori.jasper.engine.fill.JRFillBand.evaluate(JRFillBand.java:386)

at dori.jasper.engine.fill.JRVerticalFiller.fillPageBand(JRVerticalFiller.java:1099)

at dori.jasper.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:416)

at dori.jasper.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:268)

at dori.jasper.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:182)

at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:524)

at dori.jasper.engine.fill.JRFiller.fillReport(JRFiller.java:159)

at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:350)


Think from the inpuStream got , is not abale to figure out the width and height of the image.


have anyone tried using the java.awt.Image option

of the image element and can u tell me how you have implemented it.


any help on this is very much appriciated..

Thanks in advance





By: Teodor Danciu - teodord

RE: problem when passing image as java.awt.Im

2004-01-07 09:11




When loading java.awt.Image objects from input

streams you need to use a MediaTracker object

to make sure the image is fully loaded before using it.


I hope this helps.







By: Lokesh Javaji - ljavaji

RE: problem when passing image as java.awt.Image

2004-01-08 04:33

Thanks a lots...It works ...

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