[#9436] - SVG Preview - Image read failed

Category:
Bug report
Priority:
Normal
Status:
Confirmed
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
N/A
Assigned to:
0

Hi,

I tried to Preview this Report.
JRException:Image read failed.

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1 -->
<!-- 2017-04-10T17:17:16 -->
<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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="868c4850-f40d-4071-8864-a4878ff68f1a">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<import value="net.sf.jasperreports.renderers.SimpleDataRenderer"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="125" splitType="Stretch">
<image>
<reportElement x="70" y="20" width="230" height="77" uuid="557e80b1-a738-4d3d-aef4-dd6c5b374276"/>
<imageExpression><![CDATA[new SimpleDataRenderer("<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"> <rect x=\"10\" y=\"10\" height=\"100\" width=\"100\" style=\"stroke:#ff0000; fill: #0000ff\"/</svg>".getBytes(),null)]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>

(((Maybe it is the same i have in OSGI(Felix) with the org.w3c.dom.TraversalElement)))

v6.3.0
johndoe2's picture
Joined: Mar 18 2012 - 8:37am
Last seen: 6 days 6 hours ago

2 Comments:

#1
  • Status:New» Confirmed

Moving the issue to JR tracker. I verified the issue and to me it seems more likely to be a JasperReports problem. I also tried with the SimpleRenderToImageAwareDataRenderer class but the result was the same.
Maybe you can elaborate on the OSGI Felix issue you were referring to.

Regards,
Massimo.

#2

Your SVG string is invalid, the rect element is missing its closing >

Once you add the missing character, the "Image read failed" goes away. The SVG will show in HTML export, but not in the Java preview or in PDF because it doesn't have a size set. If you add something like width="200" height="200" to the svg element, it will show in Java/PDF as well.

Regards,
Lucian

Feedback
randomness