Jump to content
Changes to the Jaspersoft community edition download ×

How to use Image as parameter?

Recommended Posts

By: James Lin - inchlin

How to use Image as parameter?

2003-05-07 23:26

I try to use image in my report

The image has one "expression" field

What should I put on this field?

Suppose the parameter call "DoctorName" and the datatype is inputstream

Then I should set my image datatype to "inputstream"?


Thanks for any help!





By: Teodor Danciu - teodord

RE: How to use Image as parameter?

2003-05-11 04:44




I'm not sure where your image comes from.

If it comes from a report parameter, you should

know that you can pass anything as parameters.

And you could even pass a java.awt.Image object

from the parent application to the report.

Or you could pass the file name as a parameter,

if the image is loaded from a file.


This can be seen in the "jasper" sample,

where the image in the summary section is passed

as a java.awt.Image parameter.


But if the image comes from a data source field,

then we have a different story.

It depends on whether you are getting the data

from a database through an SQL query or if you are

supplying an in-memory JRDataSource instance.


If the image comes from a database, then I think

you should indeed declare the image corresponding

report field as a java.io.InputStrem and use it

directly in the <imageExpression>.


But if you use a custom made JRDataSource,

you have the freedom to pass the image in

whatever form your might want to: filename,

Image object, URL, etc.


I hope this helps.


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