Hi Robert,

In the code your provided in your first email, the Document was created with the proper namespace URI/qualified name for the Document element. Setting the prefix on the root element only changes the namespace URI prefix, but it does not change the fact that the element's namespace so that should not cause any difference in behavior. Fixing the width/height setting as Thomas had suggested would make a difference. Did you try not setting the prefix on svgRoot. If that does not work, I think we have a bug somewhere.

Vincent.

Robert Gash wrote:

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...






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to