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 Maria Carolina Arce Terceros <ca...@gmail.com> on 2006/05/22 05:45:13 UTC

Problems trying to resize image dynamically

Hello,

I'm having troubles trying to resize the image dinamically. If I
modify the attributes of my svg file so that width and height are
smaller than the viewbox the image gets smaller.

<svg viewBox="35 35 500 500" width="300pt" height="200pt">

But if I try to do it when loading it, the image stays the same size...

Here is my code:

final JSVGCanvas svgCanvas = new JSVGCanvas();
        svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
        svgCanvas.setURI(this.getClass().getResource("../../images/gauge5.svg").toString());
        svgCanvas.addSVGLoadEventDispatcherListener(new
SVGLoadEventDispatcherAdapter() {
            public void
svgLoadEventDispatchStarted(SVGLoadEventDispatcherEvent event) {
                doc = svgCanvas.getSVGDocument();
                Element root = doc.getDocumentElement();
                root.setAttributeNS(SVG_NAMESPACE_URI, "width", "300pt");
                root.setAttributeNS(SVG_NAMESPACE_URI, "height", "200pt");
            }
        });

Hope you can help me! Cause I really don't know what else to try and I
really need this to work...

Thanks a lot!

M. Carolina Arce Terceros

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