ananth balasubramanyam wrote:

Hi,

I have an SVGDocument created from a SVG file. I am trying to
find all the <text> elements and determine their text length and other
properties. Here is my code and it does not seem to work. Am i doing
something wrong :

NodeList textElements = doc.getElementsByTagName("text");

use getElementsByTagNameNS("http://www.w3.org/2000/svg";, "text");


  Otherwise you are asking for text elements in the 'no name'
namespace.

for (int i=0 ; i < textElements.getLength() ; ++i) {
  SVGOMTextElement textElement = (SVGOMTextElement) textElements.item(i);
  SVGOMRect rect = (SVGOMRect) textElement.getBBox();
  System.out.println(rect.getHeight());
  System.out.println(rect.getWidth());
}

I will also mention that you can only get the BBOX if the associated 'rendering tree' for the elements has been constructed See: batik.bridge.GVTBuilder.



thanks in advance, Ananth

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




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



Reply via email to