[英]net.sf.jasperreports.engine.JRException: java.io.IOException: The byte array is not a recognized imageformat
net.sf.jasperreports.engine.JRException: java.io.IOException: The byte array is not a recognized imageformat. net.sf.jasperreports.engine.JRException:java.io.IOException:字节数组不是可识别的图像格式。
I am getting this error when I am running the jrxml
file that contain images in jasper.当我运行包含 jasper 图像的jrxml
文件时出现此错误。 I have changed the version of the itext
also in pom.xml
file.我也在pom.xml
文件中更改了itext
的版本。 but its still not working, Can anyone help me with this.但它仍然无法正常工作,任何人都可以帮我解决这个问题。
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.就我而言,我试图从classpath
获取图像,并且我使用相同的对象通过更改一些值来创建两个 diff PDF。 I used FileInputStream
to read the image.我使用FileInputStream
来读取图像。 This error occurred because we can't reuse InputStream
in Java.发生此错误是因为我们无法在 Java 中重用InputStream
。
This can solve the problem:这可以解决问题:
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-all</artifactId>
<version>1.13</version>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.