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 Mayur Agrawal <ma...@Row2Technologies.com> on 2002/01/30 05:56:23 UTC
urgent!
Hi All,
I want to display a SVG using batik api.
So for the purpose we are using JSVGComponent from
org.apache.batik.swing.svg.JSVGComponent
Right now we are using the following technique
JSVGComponent svgcomp=new JSVGComponent();
svgcomp.loadSVGDocument("file://r2deploy/ProcessChem/svg/compounds/596.svg")
;
This works very fine, but we are in need of a method in batik API,
which uses String parameter (an SVG String), which will
directly take a SVG String as a parameter and display it.
So we wanted to know,
Do we have an option for this purpose ?
Please help and guide for the same
Regards
Mayur
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: urgent!
Posted by Vincent Hardy <vi...@sun.com>.
Mayur,
You can turn your string into an SVGDocument and then use the
setSVGDocument method on JSVGComponent.
To find out how to build a document from your string, see:
http://xml.apache.org/batik/domapi.html
there is a section on "Creating a Document from a SVG file" which is
the same code you can use for building from a String, except that you'll
have to use createDocument(uri, reader) instead of the straight
uri based createDocument.
I have attached a quick code example.
I hope this helps,
Vincent.
Mayur Agrawal wrote:
>
> Hi All,
>
> I want to display a SVG using batik api.
> So for the purpose we are using JSVGComponent from
> org.apache.batik.swing.svg.JSVGComponent
>
> Right now we are using the following technique
>
> JSVGComponent svgcomp=new JSVGComponent();
>
> svgcomp.loadSVGDocument("file://r2deploy/ProcessChem/svg/compounds/596.svg")
> ;
>
> This works very fine, but we are in need of a method in batik API,
> which uses String parameter (an SVG String), which will
> directly take a SVG String as a parameter and display it.
>
> So we wanted to know,
> Do we have an option for this purpose ?
>
> Please help and guide for the same
>
> Regards
> Mayur
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org