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 Roger Jakobsen <ro...@mobilearts.com> on 2006/03/06 11:25:07 UTC

Automatic streching of svg document

Hello
Is there a nice way to make the svg displayed in a canvas to 
automatically stretch when a user re-sizes the window.
////roger j

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


Re: Automatic streching of svg document

Posted by Andreas Neumann <ne...@karto.baug.ethz.ch>.
yes,

that's a very fundamental aspect of "Scalable Vector Graphics"

If you set width="100%" and height="100%" and define a viewBox 
coordinate system, your graphics will always scale to the window width.

The attribute preserveAspectRatio specifies if it scales proportionally 
or not.

See http://www.w3.org/TR/SVG11/coords.html for a definition of viewBox 
and preserveAspectRatio.

Example:

<svg xmlns="http://www.w3.org/2000/svg" 
xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" 
viewBox="0 0 450 250" xml:space="preserve">

</svg>

Andreas

Roger Jakobsen wrote:

> Hello
> Is there a nice way to make the svg displayed in a canvas to 
> automatically stretch when a user re-sizes the window.
> ////roger j
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>


-- 
----------------------------------------------
Andreas Neumann
Institute of Cartography
ETH Zurich
Wolfgang-Paulistrasse 15
CH-8093  Zurich, Switzerland

Phone: ++41-44-633 3031, Fax: ++41-44-633 1153
e-mail: neumann@karto.baug.ethz.ch
www: http://www.carto.net/neumann/
SVG.Open: http://www.svgopen.org/
Carto.net: http://www.carto.net/


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