Professional Documents
Culture Documents
Jasper Reports - Embedding Images
Jasper Reports - Embedding Images
Table of Contents
In order to include images into Emprise Jasper Reports, the images need to be converted into Base64 images
One downside of this process is that iReport has a limit of 65535 unicode characters for an image, so any image used must be relatively small and
optimized. I recommend sticking to logos only.
In the Copy Code page, copy the Base64 String. To find out if the image string is 65535 or less, you can get a character count of the string by going to
this URL
1. In iReport, right click on the Variables node in the Report Inspector tree
2. Choose Add Variable
3. In the Properties panel, add IMAGE_BYTES to the name property
4. The Variable Class should be of type java.lang.String
5. Add the base64 code string to the Initial Value Expression with the code inside double quotes
6. Set the Reset Type to Page
1. Click on window menu and then palette to launch the palette panel
2. Selec the image element and Drag a new image element to your iReport band and
3. iReport will prompt you to locate the image > choose Cancel
4. Select the image in iReport and in the Image Expression field, add
new java.io.StringBufferInputStream( new org.w3c.tools.codec.Base64Decoder($V{IMAGE_BYTES}).processString() )
5. Make sure the Expression class is java.lang.String
6. Scale Image should be Retain Shape
URLs