Sunday, 29 November 2020

Display Base64 content as image in Jaspersoft Reports

Problem statement:
Display Base64 database field as an image in  Jasper Reports. 

As on writing this page , test results showed me that byte[] data type is supported in studio to display image but not in server and eventually ended up with byte[] unsupported errors messages on jasper console.  

Software's used: 
Studio professional 7.8, "PostgreSQL 9.3.20, compiled by Visual C++ build 1600, 64-bit"

Studio design:

Output in Studio: 


SQL for creating a sample table containing Base64 image data. 

CREATE TABLE public.base64image (
	id serial PRIMARY KEY,
	image_base64 varchar(5000000) NULL
);
INSERT INTO base64image
(id,image_base64)
VALUES(1, '/9j/4AAQSkZJRgABAQAAAQABAAD/4gKgSUNDX1BST0ZJTEUAAQEAAAKQbGNtcwQwAABtbnRyUkdCIFhZWiAH4gABAA8ACAAxADhhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtkZXNjAAABCAAAADhjcHJ0AAABQAAAAE53dHB0AAABkAAAABRjaGFkAAABpAAAACxyWFlaAAAB0AAAABRiWFlaAAAB5AAAABRnWFlaAAAB+AAAABRyVFJDAAACDAAAACBnVFJDAAACLAAAACBiVFJDAAACTAAAACBjaHJtAAACbAAAACRtbHVjAAAAAAAAAAEAAAAMZW5VUwAAABwAAAAcAHMAUgBHAEIAIABiAHUAaQBsAHQALQBpAG4AAG1sdWMAAAAAAAAAAQAAAAxlblVTAAAAMgAAABwATgBvACAAYwBvAHAAeQByAGkAZwBoAHQALAAgAHUAcwBlACAAZgByAGUAZQBsAHkAAAAAWFlaIAAAAAAAAPbWAAEAAAAA0y1zZjMyAAAAAAABDEoAAAXj///zKgAAB5sAAP2H///7ov///aMAAAPYAADAlFhZWiAAAAAAAABvlAAAOO4AAAOQWFlaIAAAAAAAACSdAAAPgwAAtr5YWVogAAAAAAAAYqUAALeQAAAY3nBhcmEAAAAAAAMAAAACZmYAAPKnAAANW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fJ2dRRZUZvrEq+0o1witYJZTVR4jt7QVRBCA8icVHDEILqUuGjcUfEMMQFDDmsCkAu8zAXeOYrca4gpt0g5jC9+dZ+ozmWKZSS5SHzLHNutZ2iHIXJ0iwdHCaq1L6l46QflPWFOPaqlfjX2pT3MWdNxJ28wWbu4YwYsLZGXO2BOiaVKzmaYn/2Q==');
select * from base64image where id=1

Design Steps: 
1. Drag and drop image component from Palette. 
2. In the properties, open Expression Editor on Image tab and write below expression. 

net.sf.jasperreports.engine.util.JRImageLoader.getInstance(new SimpleJasperReportsContext()).loadAwtImageFromBytes(Base64.getDecoder().decode($F{image_base64}))

3. Save the report and Preview in Studio or Publish and run the report in JasperServer. 


JRXML: Works in 7.8 Pro Studio or later
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.21.final using JasperReports Library version 6.4.1  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Base64ImageSadakar" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="35e03267-2cbe-4840-a4ed-41342e5a701c">
	<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
	<property name="com.jaspersoft.studio.data.defaultdataadapter" value="foodmart"/>
	<property name="ireport.jasperserver.url" value="http://localhost:8080/jasperserver-pro/"/>
	<property name="ireport.jasperserver.user" value="superuser"/>
	<property name="ireport.jasperserver.reportUnit" value="/Explore/Base64ImageSadakar"/>
	<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="420"/>
	<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="566"/>
	<property name="ireport.jasperserver.report.resource" value="/Explore/Base64ImageSadakar_files/main_jrxml"/>
	<queryString language="SQL">
		<![CDATA[select * from base64image where id=1]]>
	</queryString>
	<field name="id" class="java.lang.Integer"/>
	<field name="image_base64" class="java.lang.String"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<summary>
		<band height="288">
			<image scaleImage="FillFrame" isUsingCache="false" evaluationTime="Report">
				<reportElement x="0" y="0" width="230" height="250" uuid="66f3d413-a9e1-4510-986b-7b66e323355a"/>
				<box>
					<pen lineColor="#BBBFBD"/>
					<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#BBBFBD"/>
					<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#BBBFBD"/>
					<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#BBBFBD"/>
					<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#BBBFBD"/>
				</box>
				<graphicElement fill="Solid"/>
				<imageExpression><![CDATA[net.sf.jasperreports.engine.util.JRImageLoader.getInstance(new SimpleJasperReportsContext()).loadAwtImageFromBytes(Base64.getDecoder().decode($F{image_base64}))]]></imageExpression>
			</image>
		</band>
	</summary>
</jasperReport>

References: 

Get Base64 encoding @ https://base64.guru/converter/encode/image


No comments:

Post a Comment