[xep-support] SVG Image tag pulls wrong image into PDF

From: Darren Munt <darrenm_at_ADDRESS_REMOVED>
Date: Mon Aug 29 2016 - 23:30:42 PDT

This is a very strange one. It is reproducible on my dev machine (Windows 10) and on our production server (Windows 2008 R2), so I think I can rule out environment.

I'm embedding an SVG object into the document using <fo:instream-foreign-object>. The SVG describes a line chart which uses GIF images as point markers. The images are icons which represent different questions that were asked, each icon represents one question, and they are displayed in the order that the question was answered by the user, from left to right.

The SVG is quite large so I won't copy it all, but the icons are embedded with this code:

<image x="53" y="233" width="46" height="46" xlink:href="d:\torqicons\PathAnalysis_up.gif" />

I have included the xlink namespace in SVG tag.

What is happening is that some of the <image> tags are displaying the wrong image. It seems to be completely at random. If I look at the FO, I see the correct file name, but the PDF output will have one of the other icons instead of the one that was specified. I can rebuild the PDF several times and it will either display the same incorrect icons, or it will randomly change to showing the wrong image for a different one. The only thing that is consistent is that it never shows all 12 icons correctly.

Beneath this SVG, I also have a table, which is a key to the icons. It displays the same images used in the SVG with some descriptive text. This uses exactly the same file name and they are always displayed correctly. The image is embedded with this code:

<fo:external-graphic vertical-align="middle" content-width="0.8cm" src="url(d:\torqicons\PathAnalysis_up.gif)" />

As you can see the image path is identical.

In an attempt to see where the problem is occurring, I duplicated all of the SVG image tags and added an 'x' to the end of the file name in one copy of each of the 12 images. Like this:

<image x="53" y="233" width="46" height="46" xlink:href="d:\torqicons\PathAnalysis_up.gif" />
<image x="53" y="233" width="46" height="46" xlink:href="d:\torqicons\PathAnalysis_up.gifx" />

When I transform this FO into a PDF, I see the same jumbled images but if I now look at the XEP logger output I see 12 messages like this:

SVG element 'image' ignored: com.renderx.svg.SVGParseException: java.net.MalformedURLException: Invalid URL or non-existent file: d:\torqicons\ PathAnalysis_up.gifx

They are all the correct file name and in the correct order. So this tells me that XEP is getting the correct file name and is attempting to load the correct image, but the wrong image is ending up in the output.

It appears something strange is happening in the SVG rendering. Would appreciate any assistance in getting to the bottom of it. I can supply FO to reproduce. I have attached a screenshot of the PDF output and indicated on it which icons are wrong. As I say it is random and not always the same ones that are wrong. I have included the variable part of the file name next to the icon so that it can be seen which icon is meant to be there.

_______________________________________________
(*) To unsubscribe, please visit http://lists.renderx.com/mailman/options/xep-support
(*) By using the Service, you expressly agree to these Terms of Service http://w
ww.renderx.com/terms-of-service.html

Capture.png
Received on Mon Aug 29 23:27:00 2016

This archive was generated by hypermail 2.1.8 : Mon Aug 29 2016 - 23:27:15 PDT