Jump to content
We've recently updated our Privacy Statement, available here ×

Issue in Displaying Image


rinsha.mohammed
Go to solution Solved by rinsha.mohammed,

Recommended Posts

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);[/code]

 

 

In Japser I gave 

<field name="logo" class="java.io.InputStream"/>[/code]

 

<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>[/code]

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 !!

 

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...