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 Martin Morawetz <ma...@kreativezone.at> on 2005/10/21 17:17:15 UTC

How to convert a svg file to a svg file?

Hi all,

I've already posted something similar, but since I still don't
have a solution I give it another try.

I'd like to convert a svg file to to some other formats (wmf..).
I was able to load a svg-document, but unable to render it to
an other document.

For test purposes I tried to convert an svg-file into an svg-file.


The part that worked is:

BridgeContext ctx = new BridgeContext(userAgent, loader);
ctx.setDynamic(true);
UserAgent userAgent = new UserAgentAdapter();
DocumentLoader loader = new DocumentLoader(userAgent);
SVGDocument svgDoc = (SVGDocument) loader.loadDocument(strInputFile);

I checked the document (svgDoc) and it does contain the svg-files
data.

The part that didn't work is:

// Get a DOMImplementation
DOMImplementation domImpl =
	GenericDOMImplementation.getDOMImplementation();

// Create an instance of org.w3c.dom.Document
Document document = domImpl.createDocument(null, "svg", null);

// Create an instance of the SVG Generator
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);

GraphicsNode gvtRoot = builder.build(ctx, svgDoc);
gvtRoot.paint(svgGenerator);

svgGenerator.stream(strOutputFile, useCSS);


the outputfile ist just an empty svg-file.

-- 
Regards
Martin

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