Duplicate ids under <defs>

A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).

Duplicate ids under <defs>

Postby remiohead » Mon Jun 30, 2014 9:18 pm

When showing more than one SVG document on the same page the shared resources under <defs> have duplicate ids. This is especially problematic with clip refs. We need a method to set a prefix that will be used when creating ids for clips and paints.
remiohead
 
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm

Re: Duplicate ids under <defs>

Postby remiohead » Mon Jun 30, 2014 9:28 pm

This could also be handled automatically by default, while providing the ability to set a custom prefix. When testing a fix for this myself I used the system time as the prefix.
remiohead
 
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm

Re: Duplicate ids under <defs>

Postby david.gilbert » Tue Jul 01, 2014 6:55 am

Hi,

I came across this issue already and added this method in the 1.9 release:

http://www.jfree.org/jfreesvg/javadoc/org/jfree/graphics2d/svg/SVGGraphics2D.html#setDefsKeyPrefix(java.lang.String)

…but I did not think of auto-populating the prefix, that's a very good idea (I will add that for the 2.0 release).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11620
Joined: Fri Mar 14, 2003 10:29 am

Re: Duplicate ids under <defs>

Postby remiohead » Tue Jul 01, 2014 1:21 pm

Awesome, thanks David. I need to pay closer attention to the change log in the future.

Thanks again for this fantastic tool.
remiohead
 
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm


Return to JFreeSVG

Who is online

Users browsing this forum: No registered users and 2 guests