xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Decker <decker.christ...@gmail.com>
Subject Re: Jgraph serialization and dimension attributes
Date Tue, 28 Apr 2009 14:30:06 GMT
Works great, thanks alot ^^
--
Christian Decker
http://blog.snyke.net


On Wed, Apr 22, 2009 at 12:25 PM, <thomas.deweese@kodak.com> wrote:

>
> Hi Christian,
>
> Christian Decker <decker.christian@gmail.com> 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.

Mime
View raw message