Hi All,
I need to display Images which comes from database and it's a byte array.
I am using Jasper 6.16.0 .
I initially tried to get the Image as InputStream in Japser.
InputStream logo = new ByteArrayInputStream(imagebytes) - here logo is my input variable for image
SInce I am using JsonQLDataSource in My Java for JasperFillManager.fillReport as below :
InputStream inputStream = new ByteArrayInputStream(mapper.writeValueAsBytes(myJsonDto)); JsonQLDataSource jsonData = new JsonQLDataSource(inputStream); final JasperPrint print = JasperFillManager.fillReport(report, parameters, jsonData);
In Japser I gave
<field name="logo" class="java.io.InputStream"/>
<band height="125" splitType="Stretch"> <image onErrorType="Blank"> <reportElement x="74" y="33" width="50" height="50" uuid="e93df5ef-176d-436b-a58f-ddcb0d7f6f3c"/> <imageExpression><![CDATA[$F{logo}]]></imageExpression> </image> </band>
But I am not getting my Image Displayed. When I debugged my code I could see that the image variable 'logo' is going empty in Datasource.
So I need a loution for this issue, when inputstream is going in another inputstream!
Also I tried the solution : https://community.jaspersoft.com/questions/541551/loading-byte-array-database-and-displaying-it-image , there also I didn't get Image displayed.
Could anyone please help on this !!