On Wed, 4 Jun 2003 09:27:20 -0400, Thomas E Deweese was overheard saying:
| I would at first blush guess a namespace issue of some kind. If
| your root element is not an 'svg:svg' so to say then the rasterizer
| will ignore the whole document. This is a common problem because in a
| sense the rules applied when parsing are different from the DOM rules
| - so writing the file out and re-reading it often 'fixes' the file.
Thomas,
You were correct in assuming that the problem was related to the root
node not being an "svg:svg" element. By default the root node was a
plain "svg" element. Manually setting the prefix of the root node to
"svg" corrected the problem, and the transcoder now produces the
expected images.
For those interested parties, here is the relevant snippet of code to
create a new SVGGraphics2D that you can draw on and then transcode
immediately, without having to parse the document again:
SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
Element svgRoot = doc.getDocumentElement();
svgRoot.setPrefix("svg");
// draw on svgGenerator here
svgGenerator.getRoot(svgRoot);
svgRoot.setAttributeNS(null, "width", /* width */);
svgRoot.setAttributeNS(null, "height", /* height */);
TranscoderInput ti = new TranscoderInput(doc);
// do the rest of the transcode here...
--
Robert Gash, [EMAIL PROTECTED]
(Web) http://gashalot.com/
(PGP) http://gashalot.com/pgpkeys.txt
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]