Details
-
Bug
-
Status: Open
-
Resolution: Unresolved
-
1.5
-
None
-
None
-
Operating System: All
Platform: All
Description
The document created with an SVGGraphics2D object is corrupted(becomes empty)
after invoking SVGGraphics.stream methods.The document must be explicitly set
to root before streaming (using SVGGraphics2D.getRoot(Document ) ) unless it's
lost. If this is the correct behavior, please update Javadoc (see BATIK-509).
Code example:
Document doc = ... ; // create a document with a dom implementation
SVGGraphics2D svgG2d = new SVGGraphics2D(doc);
//render into SVGGraphics2D object
svgG2d.setPaint(...); svgG2d.fill(...) ....
//stream the created Document, it works fine the first invocation
svgG2d.stream(out, true); //out is a Writer
//BUG-- spits an empty document. the created document is lost.
svgG2d.stream(out,true);
remark:
To fix this problem, one can add the following code before streaming the document:
Element root = doc.getDocumentElement();
svgG2d.getRoot(root);