SVG scaleable?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sascha Kerschhofer

    #1

    SVG scaleable?

    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


  • Kevin Reid

    #2
    Re: SVG scaleable?

    Sascha Kerschhofer <skerschhofer@y ahoo.de> wrote:
    [color=blue]
    > 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?[/color]

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

    The 'preserveAspect Ratio' attribute may also be useful.

    --
    Kevin Reid

    Comment

    • FC

      #3
      Re: SVG scaleable?


      "Sascha Kerschhofer" <skerschhofer@y ahoo.de> wrote in message
      news:bf0v1d$7ai $1@news.mch.sbs .de...[color=blue]
      > 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
      >
      >[/color]


      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


      Comment

      • Sascha Kerschhofer

        #4
        Re: SVG scaleable?

        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="ht tp://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" <flavio@tin.i t> schrieb im Newsbeitrag
        news:OrXQa.6134 9$qa5.1359213@n ews2.tin.it...[color=blue]
        >
        > "Sascha Kerschhofer" <skerschhofer@y ahoo.de> wrote in message
        > news:bf0v1d$7ai $1@news.mch.sbs .de...[color=green]
        > > 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[/color][/color]
        crop[color=blue][color=green]
        > > my SVG image when using width and height. Is there any solution?
        > >
        > > Sascha Kerschhofer
        > >
        > >[/color]
        >
        >
        > 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[/color]
        window.[color=blue]
        >
        > Bye,
        > Flavio
        >
        >[/color]


        Comment

        • Sascha Kerschhofer

          #5
          Re: SVG scaleable?

          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" <rajyas@uboot.c om> schrieb im Newsbeitrag
          news:3f15187e_2 @news.arcor-ip.de...[color=blue]
          > Sascha Kerschhofer wrote:[color=green]
          > > 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="ht tp://www.w3.org/1999/xlink">
          > >
          > > Anyway my SVG is cropped in the browser window while it should be scaled[/color][/color]
          to[color=blue][color=green]
          > > fit 100% in the browser window. Please note, that dimensions of my svg[/color][/color]
          are[color=blue][color=green]
          > > unknown when creating the HTML code but are known when creating the SVG.
          > > What am I doing wrong?
          > >[/color]
          >
          > add a viewBox attribute to the svg element and make it large enough to[/color]
          cover[color=blue]
          > your drawing.
          > ( viewBox="0 0 10000 10000" ) should be fine.
          >
          > kevin posted this already.
          >
          > r.
          >[/color]


          Comment

          • FC

            #6
            Re: SVG scaleable?


            "Sascha Kerschhofer" <skerschhofer@y ahoo.de> wrote in message
            news:bf3ivk$obe $1@news.mch.sbs .de...[color=blue]
            > 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
            >[/color]

            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


            Comment

            • Rajya Sabha

              #7
              Re: SVG scaleable?

              Sascha Kerschhofer wrote:[color=blue]
              > 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 .
              >[/color]

              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.

              Comment

              Working...