xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Morawetz <martin.moraw...@kreativezone.at>
Subject Re: How to render the content of a SVG-File into some Graphics2D Object?
Date Wed, 11 Jan 2006 16:48:52 GMT
thomas.deweese@kodak.com wrote:
> Hi Martin,
> Martin Morawetz <martin.morawetz@kreativezone.at> wrote on 01/02/2006 
> 02:27:01 PM:
>>But now I've got a new problem. I would need the size in px.
>>I was able to specify the size by using the setSVGCanvasSize()
>>Method, but as it just takes a Dimension object without
>>identifier (like px...):
>    Well 'px' are easy in SVG 'unitless' values are ==
> to the same value with 'px'.
I know, a colleague of mine has to include the svg in a pdf File,
and she insists on 'px'. So I've to provide 'px' ;-)

>>svgGraphics2D.setSVGCanvasSize(new Dimension(width, height));
>>The (more direct, I guess) approach:
>>//Element svgRoot = svgGenerator.getRoot();
>>Element svgRoot = svgGraphics2D.getDOMFactory().getDocumentElement();
>>svgRoot.setAttributeNS(null, "height", height + "px");
>>svgRoot.setAttributeNS(null, "width", width + "px");
>>didn't work. The result again is an almost empty SVG-File.
>     For a differnent reason though, you need to ensure you only
> get the DocumentElement once.

How? The chart-library we use paints into the SVGGraphics Object.
I've not found a way to get the svg-size set by modifying properties
of the chart-library.


Trying to get the DocumentElement after that doesn't work as it
creates a new one as you outlined.

Is there an other way to get the size set? Maybe without
the need to parse the document again and modifying the node?


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

View raw message