thanks, this brought me to the rigth path. just in case so. else bothers here the completer syntax:
//open existing svg file String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); String uri = "test.svg"; Document document = f.createDocument(uri); SVGGraphics2D svgGenerator = new SVGGraphics2D(document); //do some drawings with the svgGenerator object as stated in examples [...] //append the svgGenerator to the existing svg file Element svgRoot = document.getDocumentElement(); svgRoot.appendChild(svgGenerator.getRoot()); //do transcoding and save png, jpg or wathever... TranscoderInput input = new TranscoderInput(document); ... -----Original Message----- From: Thomas DeWeese [mailto:[EMAIL PROTECTED] Sent: Thursday, April 14, 2005 12:17 PM To: [email protected] Subject: Re: modify existing svg via SVGGraphics2D Hi Kai, Kai Grabfelder wrote: > i'm trying to load an existing svg file and add some drawings to it, using > the SVGGraphics2D class > but i want to have an existing svg document as a template (i just want to > draw on top of it) and so i tried > > String parser = XMLResourceDescriptor.getXMLParserClassName(); > SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); > String uri = "test.svg"; > Document document = f.createDocument(uri); > SVGGraphics2D svgGenerator = new SVGGraphics2D(document); > //following some drawings on the svgGenerator object > > but the resulting svg document does not consists of any elements present in > the test.svg input file. This is what you want to do but the SVGGraphics2D only uses the given Document as a factory it does not automatically append it's output into the Document. You would need to do this when the drawing is done with something like: svgGenerator.getRoot(document.getDocumentElement()); > my question: > > is it possible to draw on top of an existing svg file using SVGGraphics2D > and if not how is it possible then? Do i have to use JSVGCanvas? (since i > only need to create the svgs on the server side i thought this would not be > neccessary...) No you don't need to use the JSVGCanvas. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
