Jump to content
Changes to the Jaspersoft community edition download ×

Image approach for java.awt.Graphics2D objects


StackTrayce

Recommended Posts

I have been reading through the forums and docs for a couple hours now and have read about JRImageRenderer and such. I have existing java code that creates Graphics2D objects and would like to insert them into a JasperReport. At first I was thinking I could simply define a parameter with type java.awt.Image but that did not work. I then read through the JFreeChart sample and saw the scriptlet approach. Do I really need to write and use a scriptlet just to get an image from java/POJO space into jasper reports?

 

Here is some code I've tried:

Code:
      JRRenderable jrImage = JRImageRenderer.getInstance(createImage(), JRImage.ON_ERROR_TYPE_ICON);
params.put("image", jrImage);
jasperPrint = JasperFillManager.fillReport(jasperReport, params,
new JRBeanCollectionDataSource(ResultFactory.getBeanCollection()));

 

I am using iReport to set up the image properties for the jrxml but did not see JRRenderer as an option. I tried to do it by hand but still have not found success. Are there any examples around that show various ways of passing in java.awt.Images or java.awt.Graphics2D objects? Could someone point me in some possible directions or offer advice?

 

Thanks in advance.

Link to comment
Share on other sites

  • Replies 1
  • 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...