You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Robert Marcano <ro...@marcanoonline.com> on 2004/04/30 22:12:15 UTC

Offscreen elements measurement

Hola...

I have been trying to measure some elements of and SVG drawing using
DOM. The document is loaded with the following code

String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
Document doc = f.createDocument(url.toExternalForm());

So this document is using the Batik DOM Implementation and I have been
unable to get that information. When I used the SVGLocatable interface
the following exception is thrown

java.lang.NullPointerException
	at org.apache.batik.dom.svg.SVGLocatableSupport$1.getWidth(Unknown Source)

I think that the problems resides in the fact that the Document has
never been drawn

Is there some "dummy" transcoder or output target that can allow the
access to all position and measure information without the overhead of
actually performing the drawing?

My application needs to print the drawing on multiple pages, and with
some parameters given by the user, it must be able to know the
dimensions and location of some elements in order to draw them in only
one page and without clipping important text 

A workaround is to draw it on an image buffer, but this will need
multiple drawings of the same document, the first to get the location
and dimensions the other to do the actual printing.

Thanks in advance

________________________________________
Robert Marcano

web: http://www.marcanoonline.com/
blog: http://www.marcanoonline.com/plog/
________________________________________



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