StackTrayce Posted May 3, 2007 Share Posted May 3, 2007 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 More sharing options...
lucianc Posted May 3, 2007 Share Posted May 3, 2007 StackTrayce wrote:Are there any examples around that show various ways of passing in java.awt.Images or java.awt.Graphics2D objects? The "jasper" sample distributed with JasperReports (which you can also see here) includes an image which is passed as a java.awt.Image instance. HTH,Lucian Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now