SVG scaleable?

Discussion in 'XML' started by Sascha Kerschhofer, Jul 15, 2003.

  1. 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
     
    Sascha Kerschhofer, Jul 15, 2003
    #1
    1. Advertising

  2. Sascha Kerschhofer

    Kevin Reid Guest

    Sascha Kerschhofer <> 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
     
    Kevin Reid, Jul 15, 2003
    #2
    1. Advertising

  3. Sascha Kerschhofer

    FC Guest

    "Sascha Kerschhofer" <> wrote in message
    news:bf0v1d$7ai$...
    > 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
     
    FC, Jul 15, 2003
    #3
  4. 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"
    xmlns:xlink="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" <> schrieb im Newsbeitrag
    news:OrXQa.61349$...
    >
    > "Sascha Kerschhofer" <> wrote in message
    > news:bf0v1d$7ai$...
    > > 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
    >
    >
     
    Sascha Kerschhofer, Jul 16, 2003
    #4
  5. 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" <> schrieb im Newsbeitrag
    news:-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"
    > > xmlns:xlink="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.
    >
     
    Sascha Kerschhofer, Jul 16, 2003
    #5
  6. Sascha Kerschhofer

    Rajya Sabha Guest

    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.
     
    Rajya Sabha, Jul 16, 2003
    #6
  7. Sascha Kerschhofer

    FC Guest

    "Sascha Kerschhofer" <> wrote in message
    news:bf3ivk$obe$...
    > 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
    768) window and let the user pan over the hidden parts?

    Bye,
    Flavio
     
    FC, Jul 16, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arne Nordmann
    Replies:
    0
    Views:
    535
    Arne Nordmann
    Jun 28, 2004
  2. Jens Piegsa

    Scaleable Swing components

    Jens Piegsa, Dec 16, 2006, in forum: Java
    Replies:
    0
    Views:
    312
    Jens Piegsa
    Dec 16, 2006
  3. jsqrd

    Scaleable naviagtion pane

    jsqrd, Mar 2, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    292
    jsqrd
    Mar 2, 2007
  4. metaperl
    Replies:
    4
    Views:
    331
    Chris Uppal
    Mar 3, 2007
  5. Chris Thomasson
    Replies:
    3
    Views:
    432
    Chris Thomasson
    Oct 22, 2007
Loading...

Share This Page