Jump to content
We've recently updated our Privacy Statement, available here ×

tstuser

Members
  • Posts

    5
  • Joined

  • Last visited

tstuser's Achievements

  1. How to display detail band based on condition jasper report
  2. No need to encode/decode the bytea data. Just do select image as img ..., set the field type to java.awt.Image and use $F{image} as image expression.
  3. How to add dynamic image in jasper report using jasper studio Database is postgresql image is stored in bytea format how to display that image in jasper report. i used the following query to retrieve image from db in text format select encode(image,'escape') as img,id from entity_image where id = 100 jasper source code is <?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.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="image" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c591470d-2796-470b-a5ab-01b50ddf30b9"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="TST"/> <queryString language="SQL"> <![CDATA[select encode(image,'escape') as image from entity_image where id = 100]]> </queryString> <field name="image" class="java.lang.String"> <property name="com.jaspersoft.studio.field.label" value="image"/> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <detail> <band height="125" splitType="Stretch"> <image isUsingCache="true"> <reportElement x="240" y="21" width="71" height="51" uuid="65f086cd-ae8e-46c5-ba66-85f3a9b0bc28"/> <imageExpression><![CDATA[new java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($F{image}.getBytes())) ]]></imageExpression> </image> </band> </detail> </jasperReport> it shows net.sf.jasperreports.engine.jrexception: Image read failed . How to solve this?? is there any other method?
×
×
  • Create New...