Hi Thomas,
Martin Morawetz <[EMAIL PROTECTED]> wrote on 12/22/2005
02:54:39 PM:
I'd like to paint the content of an existing
Svg-File into some other Graphics2D Object.
You are going down exactly the right road here.
I experimented with BridgeContext and
GVTBuilder without success:
This code looks good, but without being able to run it
a small error could be lurking. Can you provide a small
stand-alone example (full Java source + SVG file being
read). It looks to me like there is confusion over what
part of the SVG document should be rendered. It
might be as simple as the source document lacking
width/height and/or viewBox attributes. Also if the
newSvgGraphics2D doesn't have a set 'size' it could
cause issues. All hard to track down w/o a running
example of the problem.
Thanks a lot, you just gave me the hint I needed. When
I created the the SVG-Graphics I didn't provide height
and width. Setting the size solved the problem.
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...):
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.
Any Ideas?
--
Cheers
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]