niik Posted June 29, 2009 Share Posted June 29, 2009 Hi all,Does anyone have experience printing an image from a report parameter of type java.awt.Image? The image prints, but the colors are distorted/inverted.These are the corresponding lines in the report:<parameter name="sigImage" isForPrompting="false" class="java.awt.Image"/><imageExpression class="java.awt.Image"><![CDATA[$P{sigImage}]]></imageExpression>The image is generated from an encrypted signature file before filling the report and stored as a java.awt.Image in a HashMap along with other report parameters that are passed into the report:Map parameters = new HashMap();parameters.put("sigImage",img);jasperPrint = JasperFillManager.fillReport(rptfile,parameters,ds);img is a java.awt.Image. I have tried replacing img with a JPG read from disk: same result, the image prints with inverted colors. If I export img as a file to disk from the Java program, it looks fine, even if I use the image retrieved from the HashMap. Only if I change the image expression in the report to type String and specify a file name, the image prints correctly.Any help would be appreciated, thanks in advance. Post Edited by niik at 06/29/2009 16:26 Link to comment Share on other sites More sharing options...
niik Posted June 29, 2009 Author Share Posted June 29, 2009 As a workaround, I ended up writing the image to disk as a temporary JPG file. I can pass the file name into the report as a report parameter and use an image expression of type String to print the JPG.I can use this for right now, but would appreciate any information on a cleaner solution. Thanks. Link to comment Share on other sites More sharing options...
lucianc Posted July 1, 2009 Share Posted July 1, 2009 Which JR version are you using? There has been a recent fix related to java.awt.Images, if you're not using the latest JR give it a try to see whether your problem got fixed.Regards,Lucian Link to comment Share on other sites More sharing options...
niik Posted July 1, 2009 Author Share Posted July 1, 2009 Thanks for the suggestion. I will give that a try. Link to comment Share on other sites More sharing options...
netti royala Posted October 31, 2013 Share Posted October 31, 2013 I am using 4.7 version.BMP format images are not displyed in that ,,how can i solve this error in iReport and Jasper Server .Please Help me. 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