[#5823] - While Embedding SVG image in ireport to pdf

Category:
Bug report
Priority:
Urgent
Status:
Assigned
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

I am using ireport 4.5.0.
I want to embed a svg image to generate pdf. I am using ireport preview option to run the report. I do not see any exception log during execution and the pdf generated is empty at the location of the image.
Please have a look at the image tag. Can anyone help if I am missing anything.
Link to sample svg File http://www.w3schools.com/svg/polygon4.svg
I appreciate your help.

AttachmentSize
Binary Data reportSVGTest.jrxml1.51 KB
akshayd's picture
Joined: Dec 19 2011 - 8:08am
Last seen: 11 years 3 months ago

4 Comments:

#1

I get the same problem as described by Akshyad in version 5.2 of iReport.

#2
#3

I am not sure if this is the same issue, but in 5.1.0, this works:
<image hAlign="Center" vAlign="Middle" onErrorType="Blank">
<reportElement x="0" y="25" width="572" height="94"/>
<imageExpression><![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstanceFromLocation("/some/path/to.svg")]]></imageExpression>
</image>

In 5.2.0 the same code breaks the PDF output and this exception is thrown:
sun.misc.InvalidJarIndexException: Invalid index

After trying to figure this out for a few hours, I realized that downgrading from 5.2.0 to 5.1.0 resolves it. Hopefully this will save someone else many hours of troubleshooting. I started at 5.2.0 so didn't have a recent upgrade to reverse.

#4

Hi,

Just wanted to let you know that starting with upcoming JR 6.2.2 later this year, there will be "native" support for SVG in image expressions and HTML/XML exporters.
This means you no longer need to use the BatikRenderer to load the SVG data, but simply treat SVG files like image files and they will be exported to HTML as-is, since recent versions of popular browsers support SVG very well.

Thank you,
Teodor

Feedback
randomness