Display image in pdf report-Jasper

0

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. 

Swejas's picture
5
Joined: Feb 7 2020 - 11:12pm
Last seen: 19 hours 34 min ago

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

Swejas - 1 day 5 hours ago

2 Answers:

1

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/pu..."
Then you insert the image element to you report. The expression of this Image holder is your parameter Image: $P{Image}

 

Attachments: 
AttachmentSize
Binary Data blank_a4.jrxml1.72 KB
A3an's picture
65
Joined: Apr 10 2016 - 3:13am
Last seen: 4 days 11 hours ago
0

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

Swejas's picture
5
Joined: Feb 7 2020 - 11:12pm
Last seen: 19 hours 34 min ago
Feedback