Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

net.sf.jasperreports.engine.JRException: java.io.IOException: The byte array is not a recognized imageformat

Tags:

java

image

net.sf.jasperreports.engine.JRException: java.io.IOException: The byte array is not a recognized imageformat.

I am getting this error when I am running the jrxml file that contain images in jasper. I have changed the version of the itext also in pom.xml file. but its still not working, Can anyone help me with this.

like image 697
Harsha Avatar asked Aug 31 '25 20:08

Harsha


1 Answers

In my case, I was trying to fetch the image from the classpath, and I was using the same object for creating two diff PDF by changing some values. I used FileInputStream to read the image. This error occurred because we can't reuse InputStream in Java.

like image 139
cafedead Avatar answered Sep 03 '25 11:09

cafedead