If you are using JSVGCanvas, make sure you set the document state:

canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
*
*
*
*If not using canvas, you'll need to boot the dom:

http://wiki.apache.org/xmlgraphics-batik/BootSvgAndCssDom



On Thu, Sep 27, 2012 at 8:47 AM, fireball <samiib...@hotmail.com> wrote:

> I have svg as shown below. Whenever I load this svg and try to get BBox of
> its text it returns null. How to properly get the BBox?
>
> Element eltText = document.getElementById("id3");
> SVGRect svgRect = ((SVGOMTextElement)eltText).getBBox(); <-- returns null
>
>
> <svg
>    xmlns="http://www.w3.org/2000/svg";
>    version="1.1"
>    id="id">
>   <g
>      id="id1"
>      transform="matrix(1,0,0,1,0,0)">
>     <rect
>        id="id2"
>        width="10"
>        height="10"
>        fill="none"
>        stroke="#ffffff"/>
>     <text
>        id="id3"
>        x="10"
>        y="10"
>        font-style="normal"
>        text-decoration="none"
>        font-weight="normal"
>        font-size="12"
>        font-family="none"
>        fill="red">
>        text</text>
>   </g>
> </svg>
>
>
>
> --
> View this message in context:
> http://batik.2283329.n4.nabble.com/getBBox-returns-null-tp4655273.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org
>
>

Reply via email to