xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hugh Eland <h...@2020media.com>
Subject SVGGraphics2D to create a DOM document
Date Sat, 10 Aug 2002 16:30:11 GMT

I am trying to use SVGGraphics2D to create a DOM document, which I will then output in various
formats in my application.
The below code always produces a

Error in transcoder org.apache.batik.transcoder.TranscoderException: The specified XML document
fragment is not an SVG document

>From reading the newsgroups I now understand that the  document is only used as a factory,
and not populated by the SVGraphics.

I have tried following the stuff on the new getRoot() method ( http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9520
) but don't immediately see how this helps...

Is this the wrong approach? - I want the graphics stored in DOM document so I can output in
different forms...

(Tried with Batik 1.5b3 and JDK1.4)



	SVGGraphics2D sg;
	DOMImplementation domImpl = // Get a DOMImplementation

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

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

	// Draw the image

		JPEGTranscoder t = new JPEGTranscoder();
                             new Float(.8));
		TranscoderInput input = new TranscoderInput(document);
		TranscoderOutput output = new TranscoderOutput(ostream);
        		t.transcode(input, output);
		return true;

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

View raw message