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 rehan shaikh <fr...@yahoo.com> on 2003/05/18 13:17:36 UTC

How to insert a reference to a local image file using SVGGraphics2D object? (Rehan)

Hi
    I am new to Batik. I am trying to create a SVG
file dynamically using Batik. I would like to know how
to insert the line below into the SVG using an object
of class SVGGraphics2D.
<image x="200" y="200" width="100" height="100"
href="C:/Rehan/document2x.jpg">

thanks for your help
Rehan


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

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


Re: How to insert a reference to a local image file using SVGGraphics2D object? (Rehan)

Posted by Vincent Hardy <vi...@sun.com>.
Hi Rehan,

There are two ways you could do this:

a. Draw your image into the Graphics2D. SVGGraphics2D gives you options 
to either embed the images (as Base64) or reference them. In both cases, 
the original URL will not be used, so this may only be partially what 
you want.

b. Manipulate the DOM directly. You can use the regular DOM API to add 
you image.
    Something like:
    Element img = document.createElementNS(svgNS, "image");
    img.setAttributeNS(xlinkNS, "xlink:href", ".....");
    img.setAttributeNS(null, "x", ....);

Vincent.

rehan shaikh wrote:

>Hi
>    I am new to Batik. I am trying to create a SVG
>file dynamically using Batik. I would like to know how
>to insert the line below into the SVG using an object
>of class SVGGraphics2D.
><image x="200" y="200" width="100" height="100"
>href="C:/Rehan/document2x.jpg">
>
>thanks for your help
>Rehan
>
>
>__________________________________
>Do you Yahoo!?
>The New Yahoo! Search - Faster. Easier. Bingo.
>http://search.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>  
>



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