Hi Christian,
Christian Decker <[email protected]> wrote on 04/20/2009 07:09:09
PM:
> It all works, but for the attributes (and some minor fiddling with
> namespace declarations being at the second level instead of the root
> element, but that's another story).
> Any idea on how to add the height and width elements?
I think you mean attributes, the simplest way is
to simply set them yourself on the root element:
// get the root element (the svg element)
Element svgRoot = g2.getRoot();
// ^^^^This line doesn't do anything
graph.paint(g2);
g2.getRoot(document.getDocumentElement());
document.getDocumentElement().setAttributeNS(null, "width", "" +
widthInPix);
document.getDocumentElement().setAttributeNS(null, "height", "" +
heightInPix);
You can also call "setSVGCanvasSize(Dimension svgCanvasSize)" on the
SVGGraphics2D instance before you call paint.