gustavo.alvarenga Posted July 14 Share Posted July 14 Hello, I'm trying to generate a PDF report on JR 6.19.1 with images on it; those images are loaded as BufferedImage in our application and fed to JasperReports through a JRDataSource. It usually works, but sometimes I get the following error:net.sf.jasperreports.engine.JRException: No appropriate image writer found for the "jpeg" format.It seems to happen when we try using .png images in the report. Looking at the source code for JRJdk14ImageEncoder, I can see the following snippet:switch (imageType){ case JRRenderable.IMAGE_TYPE_GIF : { formatName = "gif"; break; } case JRRenderable.IMAGE_TYPE_PNG : { formatName = "png"; break; } case JRRenderable.IMAGE_TYPE_TIFF : { formatName = "tiff"; break; } case JRRenderable.IMAGE_TYPE_JPEG : case JRRenderable.IMAGE_TYPE_UNKNOWN : default: { formatName = "jpeg"; break; }}[/code]What defines the "imageType" variable there? Is there any way I can tell the report to render all pictures as "png" or something like that? Link to comment Share on other sites More sharing options...
accounts_8 Posted July 17 Share Posted July 17 I always use SimpleDataRenderer for Images. E.g.:if( jrField.getName().equals(ExportFields.LOGO.getField()) ) return SimpleDataRenderer.getInstance( imageByteData ) Link to comment Share on other sites More sharing options...
Mehak Rajkumar Posted July 18 Share Posted July 18 Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times. Link to comment Share on other sites More sharing options...
rpeguet Posted July 20 Share Posted July 20 Hello,I see there're some recommendations in the comments. Did it help or can I get one of our engineers to try to chime in some light on the ImageEncoder? Link to comment Share on other sites More sharing options...
Solution gustavo.alvarenga Posted July 20 Author Solution Share Posted July 20 Based on accounts_8's comment, I swapped out the BufferedImage mapping for a SimpleDataRenderer and it worked perfectly with the pictures that had been giving me issues. 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