Hi Hai,
"Hai Yun Tao" <[EMAIL PROTECTED]> wrote on 04/28/2007 05:46:06 AM:
> I am writing a test program to load a svg file and use the <use> tag to
> reference that external resource, and show it in JSVGCanvas. The
challenge
> comes when i must know the dimension of the svg file, so that i will set
it
> in the <use> tag to make sure the scale of the referenced svg file is
always
> 1:1.
You can't reference an SVG file with a use, you can only reference a
subpart of an SVG file.
> For some of the works this is possible because i can get the dimension
> by accessing the "width" and "height" attributes from the <svg> element,
but
> NOT all svg documents has them set and in fact, these values also are
not
> reliable values.
They are too reliable values. In fact documents that lack
width/height
are in some sense unknowable as to what the correct size is. For example
it is common for Cartographic SVG documents to use _very_ large coordinate
systems (100's of thousands of units wide) the correct way to render these
is not 1:1.
> So is there any other batik API i can take a look to get
> the true dimension of a svg file?
That all said if you build the GVT tree (see booting SVG and CSS DOM)
for an SVG document you can call 'getBBox' and it will give you the size
of the element in it's local coordinate system.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]