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

Display image in pdf report-Jasper


Swejas

Recommended Posts

Hi,

I am trying to display the image in the pdf report using jasper library using <imageexpression>.

<image scaleImage="RetainShape" onErrorType="Blank">
                <imageExpression><![CDATA[$P{XYZ}]]></imageExpression>
 </image>

Image URL is fetched from other server file location, below is the two scenarios:

1. First case my image is in $P{XYZ}-http://servername/filepath/xxx.jpg.

This image which is in http location fetched and displayed in the pdf properly.

2. But in the other case same image is accessed using $P{XYZ}- https://servername/filepath/xxx.jpg. 

In the case 2, image is not displayed in the pdf report while generating.

Can anyone help me out with this issue why is it happening and how to retrieve from the https url and display in the pdf. 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Dear Swejas

First you make a parameter and you name it for example Image.
The default value expression is the linkt to the Image between quotes like "https://www.jaspersoft.com/sites/jaspersoft/files/styles/banner_large/public/2020-05/main-bg.jpg"
Then you insert the image element to you report. The expression of this Image holder is your parameter Image: $P{Image}

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi, 

Thank You A3an, I used same as you suggested. When I give the https  image which you provided for sample in my jrxml image is displayed in the pdf. But my filepath which i am reading from the path is throwing Byte Data Not Found at  https://servername/filepath/xxx.jpg. error is thrown. Do you have any idea about this? Whether any security issue or image is not accessibile from that path?

Thanks in advance

Link to comment
Share on other sites

Hi, 

Thank You A3an, I used same as you suggested. When I give the https  image which you provided for sample in my jrxml image is displayed in the pdf. But my filepath which i am reading from the path is throwing Byte Data Not Found at  https://servername/filepath/xxx.jpg. error is thrown. Do you have any idea about this? Whether any security issue or image is not accessibile from that path?

Thanks in advance

Link to comment
Share on other sites

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