Hi,
On Tue, 2006-08-22 at 08:10 -0700, csanfeb wrote:
> I've got an unusual question that I've been having a difficult time finding
> an answer to...
>
> I want to create a svg on the fly for putting onto a JFramel. Strange part
> is I want to create the svg based off a string such as follows:
>
> String theString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg
> PUBLIC '-//W3C//DTD SVG 1.0//EN'
> 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'><svg
> xmlns:xlink=\"http://www.w3.org/1999/xlink\" style=\"fill-opacity:1;
> color-rendering:auto; color-interpolation:auto; text-rendering:auto;
> stroke:black; stroke-linecap:square; stroke-miterlimit:10;
> shape-rendering:auto; stroke-opacity:1; fill:black; stroke-dasharray:none;
> font-weight:normal; stroke-width:1; font-family:'Dialog';
> font-style:normal; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0;
> image-rendering:auto;\" xmlns=\"http://www.w3.org/2000/svg\"><defs
> id=\"genericDefs\" /><g><text xml:space=\"preserve\" x=\"10\" y=\"30\"
> style=\"stroke:none;\">My Text...</text></g></svg>";
>
> Now I am trying to figure out a way to do this without creating a temp file.
> Does anybody know a way to do this?
You might be able to insert those additional properties using SVG DOM
API. eg:
// create the empty SVG DOM as usual
SVGDocument doc = .....
// insert the additional properties
Element svgRoot = doc.getDocumentElement();
SVGStylable stylable = (SVGStylable)svgRoot;
CSSStyleDeclaration cssStyle = stylable.getStyle();
// insert one by one the additional properties
cssStyle.setProperty("stroke","black", "");
cssStyle.setProperty("text-rendering","auto", "");
cssStyle.setProperty("fill-opacity","1", "");
....
// insert defs element
....
// insert g inside defs
...
Please check SVG DOM API documentation for the correct function /
methods calls
Regards
Tonny Kohar
--
Sketsa
SVG Graphics Editor
http://www.kiyut.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]