JasperReportsPlugIn Problem with Image from Datafield

Questions and answers on developing, deploying and using plugins and JavaBeans

JasperReportsPlugIn Problem with Image from Datafield

Postby wichmann » Wed Dec 19, 2018 2:21 pm

I try to implement a Image directly from mySQL Database (Media-Field) in Jasper Reports.

However, various attempts brought no success.

I think this should possible ... or not?
Is this a problm with my Software configuration?
Can anyone help

Installed Software:

Servoy 8.3.2
Jasper Studio 6.5.1
Barcode_Servoy_JasperReports_Plugin_v.6.4.1.7z.001
Barcode_Servoy_JasperReports_Plugin_v.6.4.1.7z.002

BR
Andreas
DataBit GmbH
Mühletobel
CH-9217 Neukirch an der Thur
wichmann
 
Posts: 23
Joined: Fri Apr 12, 2013 2:44 pm

Re: JasperReportsPlugIn Problem with Image from Datafield

Postby murmi » Thu Dec 20, 2018 9:40 am

Hi Andreas

I use an Image Control and as an expression
$P{cMandLogo} != null ? net.sf.jasperreports.engine.util.JRImageLoader.loadImage((byte[])$P{cMandLogo}) : null

cMandLogo is passed to the report engine as Parameter, which is nothing more as the content of a database field. Instead of $P{param} you should be able to use $F{Field}.

HTH
Fritz
Fritz Maurhofer
Maurhofer Informatik AG
CH-8340 Hinwil
murmi
 
Posts: 41
Joined: Thu Jul 22, 2010 5:10 pm

Re: JasperReportsPlugIn Problem with Image from Datafield

Postby Gabi Boros » Fri Dec 21, 2018 4:40 pm

here is an example that may help:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.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/xs ... report.xsd" name="f_products" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="96b8fd89-386b-483b-9a1f-4df248f4f63f">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="UDM.xml"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="product_image" class="java.lang.Object"/>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="199" splitType="Stretch">
<image>
<reportElement x="0" y="10" width="150" height="150" uuid="1e283262-ea36-461c-8484-d82cc0b6178d"/>
<imageExpression class="java.awt.Image"><![CDATA[net.sf.jasperreports.engine.util.JRImageLoader.getInstance(DefaultJasperReportsContext.getInstance()).loadAwtImageFromBytes((byte[])$F{product_image})]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
Gabi Boros
Servoy
Gabi Boros
 
Posts: 399
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 8 guests