Hi there,
i'm trying for more then 20 hourse now to embedd a svg image in my Report. All information i could find on the Internet did not help.
<?xml version="1.0" encoding="UTF-8"?>
<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="testsvg" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="19f7311d-5d18-4868-b8a6-625777963967">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="svg" class="java.lang.String"/>
<queryString>
<![CDATA[select * from qo_form]]>
</queryString>
<field name="form_id" class="java.lang.Long">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<title>
<band height="247" splitType="Stretch">
<image scaleImage="RetainShape" hAlign="Center" vAlign="Middle" isUsingCache="false">
<reportElement uuid="25eb24ec-3a2a-4be4-8b86-c3ced662b0c7" mode="Transparent" x="0" y="0" width="273" height="235"/>
<imageExpression><![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstance(new java.io.File("E:\\reports\\test.svg"))]]></imageExpression>
</image>
</band>
</title>
</jasperReport>
Every time i compile and render the jrxml i get a rectangle back no matter what form or information the svg has. The rectangle only fills the image width and height and it only works if the svg starts on x=0 and y=0.
I really need help.
Thanks
4 Answers:
In the end i want a pdf file but i tested it in iReports Designer 5.1.0 in the internal preview
my svg file is just a simple test file:
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><rect width="105.71429" height="80" x="351.42856" y="152.36218" id="rect1" style="fill:#008000"></rect><rect width="120" height="85.714287" x="0" y="0" id="rect2" style="fill:#008000"></rect></svg>
if i change it to
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" height="480" width="640"><rect width="105.71429" height="80" x="351.42856" y="152.36218" id="rect1" style="fill:#008000"></rect><rect width="120" height="85.714287" x="0" y="0" id="rect2" style="fill:#008000"></rect></svg>
it works
Hi Teodor,
is there anything changed concerning embedding SVGs to JasperPrintXMLs in some version > 4.7.0?
We more and more get questions from our customers that want to use SVGs instead of JPGs.
See my other post here: http://community.jaspersoft.com/questions/542921/svg-quality-pdfs-vs-jas...
regards
C-Box