You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Maciej Dybał <ma...@comarch.com> on 2012/06/21 14:12:37 UTC

Displaying elements with gradients in on-the-fly build SVGDocument

Hello!

As this it my first post to this mailing list I would like to welcome 
everyone!

I have a problem with properly displaying a SVGDocument (build 
on-the-fly) in JSVGCanvas and I would really appreciate some guidance.

I use Java 1.6 on Windows XP. In my app I store SVGConfiguration as a 
CLOB in database. In the runtime I get the String from database, create 
a SVGDocument and display it on JSVGCanvas. This works fine until I have 
some gradients defined in <defs> node. In this case no exception is 
thrown but the elements using gradients are not drawn at all.

I tried to find some soultion on the web and in the mailing-list archive 
but came out empty-handed. Setting a xml:base with following code did 
not help:

     URL baseURL = new URL(new java.io.File("").toURL().toExternalForm());
     String url = baseURL.toString();
     ((SVGOMDocument)doc).setURLObject(baseURL);

Neither did adding this URL to <defs> subnodes.

The SVG file I use is attached to this mail (hope attachments are allowed)

Best regards,
Maciek


Re: Displaying elements with gradients in on-the-fly build SVGDocument

Posted by Maciej Dybał <ma...@comarch.com>.
Hit Thomas,

I use batik 1.7 official release. Because time is of essence for me now 
I found a workaround (not pretty I admit) - after creating document, I 
save it as a temporary file on disc, and load it to canvas. That 
resolves the problem.

I was a bit surprised but I didn't see any stacktrace and didn't get any 
error message while opening this document. However, before aplying the 
above mentioned workaround I observed one more interesting thing. When I 
ommited this gradient styles in <defs> node, batik showed an error 
message stating that styles used in nodes cannot be found. After adding 
the styles the error didn't occur, but still (as I mentioned before) 
nodes with gradients were not drawn.

Best regards,
Maciek
> Hi Maciek,
>
> On Jun 21, 2012, at 8:12 AM, Maciej Dybał wrote:
>
>> I have a problem with properly displaying a SVGDocument (build on-the-fly) in JSVGCanvas and I would really appreciate some guidance.
>>
>> I use Java 1.6 on Windows XP. In my app I store SVGConfiguration as a CLOB in database. In the runtime I get the String from database, create a SVGDocument and display it on JSVGCanvas. This works fine until I have some gradients defined in <defs> node. In this case no exception is thrown but the elements using gradients are not drawn at all.
>>
>> I tried to find some soultion on the web and in the mailing-list archive but came out empty-handed. Setting a xml:base with following code did not help:
>>
>>     URL baseURL = new URL(new java.io.File("").toURL().toExternalForm());
>>     String url = baseURL.toString();
>>     ((SVGOMDocument)doc).setURLObject(baseURL);
> 	In my experience providing a URL to the document with SetURLObject as you do here has always resolved these sorts of issues.  Also have you tried the current SVN version of Batik?
>
> 	You should be getting some sort of error as well, can you dig any up?
>
> 	Thomas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Displaying elements with gradients in on-the-fly build SVGDocument

Posted by DeWeese Thomas <th...@gmail.com>.
Hi Maciek,

On Jun 21, 2012, at 8:12 AM, Maciej Dybał wrote:

> I have a problem with properly displaying a SVGDocument (build on-the-fly) in JSVGCanvas and I would really appreciate some guidance.
> 
> I use Java 1.6 on Windows XP. In my app I store SVGConfiguration as a CLOB in database. In the runtime I get the String from database, create a SVGDocument and display it on JSVGCanvas. This works fine until I have some gradients defined in <defs> node. In this case no exception is thrown but the elements using gradients are not drawn at all.
> 
> I tried to find some soultion on the web and in the mailing-list archive but came out empty-handed. Setting a xml:base with following code did not help:
> 
>    URL baseURL = new URL(new java.io.File("").toURL().toExternalForm());
>    String url = baseURL.toString();
>    ((SVGOMDocument)doc).setURLObject(baseURL);

	In my experience providing a URL to the document with SetURLObject as you do here has always resolved these sorts of issues.  Also have you tried the current SVN version of Batik?

	You should be getting some sort of error as well, can you dig any up?

	Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org