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 Edouard Marquez <an...@gmail.com> on 2010/04/27 23:46:19 UTC

How to resize an svg

Hello !

I have a svg file of 100x100 pixels (for example).

If I do a :

JSVGCanvas svg = new JSVGCanvas();
[...]

svg.setSize(10,10);

It will only show this part of the 100x100picture.

Do you know how I can display a resized svg picture ?

Thanks [?]

Re: How to resize an svg

Posted by Edouard Marquez <an...@gmail.com>.
Thanks.
This attribute was not set and not it works well :)

On Wed, Apr 28, 2010 at 12:02 AM, jonathan wood
<jo...@gmail.com>wrote:

>
>   Unless an alternate view/transform is specified, I believe that
> JSVGCanvas will honor the viewBox attribute.  Check your svg input file to
> see if a viewBox attribute is present or insert one programmatically after
> it is loaded possibly.
>
> for instance...if you want the canvas to show all of your svg (100x100) no
> matter what the canvas size, use the following:
>
> <svg viewBox="0 0 100 100" ...>
>
> For reference:
>
> http://www.w3.org/TR/SVG/coords.html#ViewBoxA<svg viewBox="0 0 100 100"
> ...>ttribute <http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute>
>
>
>
> On Tue, Apr 27, 2010 at 5:46 PM, Edouard Marquez <an...@gmail.com>wrote:
>
>>  Hello !
>>
>> I have a svg file of 100x100 pixels (for example).
>>
>> If I do a :
>>
>> JSVGCanvas svg = new JSVGCanvas();
>>
>>
>>
>>
>>
>> [...]
>>
>>
>>
>>
>>
>>
>> svg.setSize(10,10);
>>
>>
>>
>>
>>
>>  It will only show this part of the 100x100picture.
>>
>> Do you know how I can display a resized svg picture ?
>>
>> Thanks [?]
>>
>
>

Re: How to resize an svg

Posted by jonathan wood <jo...@gmail.com>.
  Unless an alternate view/transform is specified, I believe that JSVGCanvas
will honor the viewBox attribute.  Check your svg input file to see if a
viewBox attribute is present or insert one programmatically after it is
loaded possibly.

for instance...if you want the canvas to show all of your svg (100x100) no
matter what the canvas size, use the following:

<svg viewBox="0 0 100 100" ...>

For reference:

http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute


On Tue, Apr 27, 2010 at 5:46 PM, Edouard Marquez <an...@gmail.com>wrote:

>  Hello !
>
> I have a svg file of 100x100 pixels (for example).
>
> If I do a :
>
> JSVGCanvas svg = new JSVGCanvas();
>
>
> [...]
>
>
>
> svg.setSize(10,10);
>
>
>  It will only show this part of the 100x100picture.
>
> Do you know how I can display a resized svg picture ?
>
> Thanks [?]
>