Embedding image in JRXML template

0

I have already gone though the instructions provided at http://community.jaspersoft.com/questions/523992/tip-embedding-images-reports

But, when I declare a variable in my JRXML file something like:

<variable name="image" class="java.lang.String">
  <variableExpression>
    <![CDATA[iVBORw0KGgoAAAAN2TywgvThXo6zmQqSkeB29keB9/JGVlWmyjrJu5yV7vvbwVfZpMt6baX2QZZVhw1rB1cWfZLQN3dMKWddRRY6t9N1ncr6dI4uSfRDossO1g8/ZqkJ8sKOZKQrKj5/LTNuKHkha53kxXF33bSqHdnyEXWVOurL+B6suSKZ5xvPFlRUh6V1hsx7ydr54HF0+/7i5pZ1tQgLr/a7cmyXsXQYVlRthFIl/l8Z91+eEdZUbr1yKI+WADOsqYJ/fKPBnxZYgQd5+aArI3ymvWNbfchzz1lRXEefFpeHEWpb/05ii9LzBTjZnXqPTfse2tSuQU21krDeWp8Ttbrniw50TXKz/04Rp1+6PTl1h861eZlIbEPmelxRNwu18yHBl1ZvfoqAw9x0+JTW81fVF2EJLIKUGVWTDRFnPKIbDj9ztMyD5Zbj5DDLWsy1F7+CZ32g18v1tiMj3WTFf3SOU82XvqxvqgPCOa0E5t3EVbSZ19kzckfXvDjzAtYsvpXup2xAVmCTCyufkw/KJeHkrdm8P+EblZ+mwZk/xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANyRfwA6ydK0t2f0GgAAAABJRU5ErkJggg==]]>
  </variableExpression>
</variable>

I always get compilation errors.

Can anyone suggest me any solution for this?
Thanks
abhimanyu.prasad's picture
Joined: Nov 25 2013 - 2:18am
Last seen: 4 years 3 months ago

2 Answers:

1

Hey thanks a lot, Ben. Actually, I had tried with the double quotes, but I was always evaluating it under <variableexpression>. The same thing worked if we do the same inside <initialValueExpression>:

<variable name="encImage" class="java.lang.String">
       <initialValueExpression><![CDATA["iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAMAA…"]]>
</variable>

The thing striked as soon as I saw your reply.

Regards,

Abhimanyu

abhimanyu.prasad's picture
Joined: Nov 25 2013 - 2:18am
Last seen: 4 years 3 months ago
1

I beleive that the base64 string needs to be enclosed in double quotes so that ireport doesn't try to process it.

eg.

<!CDATA["iVBORw0KGg....etc"]].

Hope that helps.

bschipper's picture
Joined: Dec 10 2012 - 9:50pm
Last seen: 5 years 4 months ago
Feedback