Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > SVG scaleable?

Reply
Thread Tools

SVG scaleable?

 
 
Sascha Kerschhofer
Guest
Posts: n/a
 
      07-15-2003
Hi,

I wonder if SVG can be scaled, when embedded in a HTML Dokument like an
image with its width and height atributes.. Adobe SVG Viewer seems to crop
my SVG image when using width and height. Is there any solution?

Sascha Kerschhofer


 
Reply With Quote
 
 
 
 
Kevin Reid
Guest
Posts: n/a
 
      07-15-2003
Sascha Kerschhofer <(E-Mail Removed)> wrote:

> Hi,
>
> I wonder if SVG can be scaled, when embedded in a HTML Dokument like an
> image with its width and height atributes.. Adobe SVG Viewer seems to crop
> my SVG image when using width and height. Is there any solution?


Specify the 'viewBox' attribute on the 'svg' element.

The 'preserveAspectRatio' attribute may also be useful.

--
Kevin Reid
 
Reply With Quote
 
 
 
 
FC
Guest
Posts: n/a
 
      07-15-2003

"Sascha Kerschhofer" <(E-Mail Removed)> wrote in message
news:bf0v1d$7ai$(E-Mail Removed)...
> Hi,
>
> I wonder if SVG can be scaled, when embedded in a HTML Dokument like an
> image with its width and height atributes.. Adobe SVG Viewer seems to crop
> my SVG image when using width and height. Is there any solution?
>
> Sascha Kerschhofer
>
>



Specify width='100%' height='100%' (or any other value of your choosing)
inside the main svg element, instead of using fixed values.
This will enable the scaling of graphics relative to the size of the window.

Bye,
Flavio


 
Reply With Quote
 
Sascha Kerschhofer
Guest
Posts: n/a
 
      07-16-2003
Thank You,

my HTML has this line
<OBJECT DATA="epm2.svg" WIDTH="100%" HEIGHT="100%" TYPE="image/svg+xml">

and my SVG has this
<svg width='100%' height='100%' version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlnslink="http://www.w3.org/1999/xlink">

Anyway my SVG is cropped in the browser window while it should be scaled to
fit 100% in the browser window. Please note, that dimensions of my svg are
unknown when creating the HTML code but are known when creating the SVG.
What am I doing wrong?

Sascha Kerschhofer


"FC" <(E-Mail Removed)> schrieb im Newsbeitrag
news:OrXQa.61349$(E-Mail Removed)...
>
> "Sascha Kerschhofer" <(E-Mail Removed)> wrote in message
> news:bf0v1d$7ai$(E-Mail Removed)...
> > Hi,
> >
> > I wonder if SVG can be scaled, when embedded in a HTML Dokument like an
> > image with its width and height atributes.. Adobe SVG Viewer seems to

crop
> > my SVG image when using width and height. Is there any solution?
> >
> > Sascha Kerschhofer
> >
> >

>
>
> Specify width='100%' height='100%' (or any other value of your choosing)
> inside the main svg element, instead of using fixed values.
> This will enable the scaling of graphics relative to the size of the

window.
>
> Bye,
> Flavio
>
>



 
Reply With Quote
 
Sascha Kerschhofer
Guest
Posts: n/a
 
      07-16-2003
Sorry but when I set viewbox dimensions 10000 x 10000 Adobe SVG Viewer
displays my SVG very smal. I sugest the whole browser window has 10000 x
10000 units and whatever the dimensions of my drawing is it is scaled
correspondingly.

Sascha Kerschhofer

"Rajya Sabha" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)-ip.de...
> Sascha Kerschhofer wrote:
> > Thank You,
> >
> > my HTML has this line
> > <OBJECT DATA="epm2.svg" WIDTH="100%" HEIGHT="100%" TYPE="image/svg+xml">
> >
> > and my SVG has this
> > <svg width='100%' height='100%' version="1.1"
> > xmlns="http://www.w3.org/2000/svg"
> > xmlnslink="http://www.w3.org/1999/xlink">
> >
> > Anyway my SVG is cropped in the browser window while it should be scaled

to
> > fit 100% in the browser window. Please note, that dimensions of my svg

are
> > unknown when creating the HTML code but are known when creating the SVG.
> > What am I doing wrong?
> >

>
> add a viewBox attribute to the svg element and make it large enough to

cover
> your drawing.
> ( viewBox="0 0 10000 10000" ) should be fine.
>
> kevin posted this already.
>
> r.
>



 
Reply With Quote
 
Rajya Sabha
Guest
Posts: n/a
 
      07-16-2003
Sascha Kerschhofer wrote:
> Sorry but when I set viewbox dimensions 10000 x 10000 Adobe SVG Viewer
> displays my SVG very smal. I sugest the whole browser window has 10000 x
> 10000 units and whatever the dimensions of my drawing is it is scaled
> correspondingly.
>


you can specify any values you like there. if you want your entire document to
be displayed, make sure the viewBox is big enough.

r.

 
Reply With Quote
 
FC
Guest
Posts: n/a
 
      07-16-2003

"Sascha Kerschhofer" <(E-Mail Removed)> wrote in message
news:bf3ivk$obe$(E-Mail Removed)...
> Sorry but when I set viewbox dimensions 10000 x 10000 Adobe SVG Viewer
> displays my SVG very smal. I sugest the whole browser window has 10000 x
> 10000 units and whatever the dimensions of my drawing is it is scaled
> correspondingly.
>
> Sascha Kerschhofer
>


If you define a viewport 0 0 10000 10000 and the picture is 1000 x 1000, it
will be rendered using 10% of the available viewing frame.
On the other hand, if the viewport is 0 0 500 500, it will be clipped
because it doesn't fit, although you can pan (and zoom) using the mouse (at
least with Adobe SVG viewer).
Are you sure that you can't calculate roughly the size of the picture?
What's wrong with sizing the viewport to a "standard" 800x600 (or 1024 x
76 window and let the user pan over the hidden parts?

Bye,
Flavio


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: svg-chart 1.1 SVG Charting Library Helmut Jarausch Python 0 05-20-2008 11:05 AM
svg to svg saving problem milof83 Java 1 08-18-2006 07:36 PM
[SVG] probleme dessin d'images SVG avec Batik Mardagg Java 0 05-12-2006 02:13 PM
[SVG] problem with SVG image drawing with Batik Library Mardagg Java 0 05-12-2006 02:12 PM
[SVG] using image-tag to integrate SVG in SVG Arne Nordmann XML 0 06-28-2004 01:16 PM



Advertisments