So in my jrxml file I have the following:
<parameter name="smileyfaceimage" class="java.lang.String"/>
Then I reference it in:
<image scaleImage="FillFrame" onErrorType="Blank">
<reportElement x="167" y="62" width="363" height="171" backcolor="#333333"/>
<imageExpression class="java.lang.String"><![CDATA[$P{smileyfaceimage}]]></imageExpression>
</image>
Is this not correct?
I've tried the base64 both with and without:
data:image/png;base64,
Here's the image im working with
Then I used https://www.base64-image.de/ or any random site to get the base64 string. I tested the string it produces and it's valid.
Now in my code;
- set the value of a variable to the based64 string
- on the template
- set the parameter:
<parameter name="smileyfaceimage" class="java.lang.String"/>
- set the parameter:
then add the image data to the page:
<image scaleImage="FillFrame" onErrorType="Blank"> <reportElement x="167" y="62" width="363" height="171" backcolor="#333333"/> <imageExpression><![CDATA[new java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($P{smileyfaceimage}.getBytes()))]]></imageExpression> </image>
Am I missing a step?