473,414 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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
Jul 20 '05 #1
6 2057
Sascha Kerschhofer <sk**********@yahoo.de> 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
Jul 20 '05 #2
FC

"Sascha Kerschhofer" <sk**********@yahoo.de> wrote in message
news:bf**********@news.mch.sbs.de...
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
Jul 20 '05 #3
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" <fl****@tin.it> schrieb im Newsbeitrag
news:Or*********************@news2.tin.it...

"Sascha Kerschhofer" <sk**********@yahoo.de> wrote in message
news:bf**********@news.mch.sbs.de...
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

Jul 20 '05 #4
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" <ra****@uboot.com> schrieb im Newsbeitrag
news:3f********@news.arcor-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.

Jul 20 '05 #5
FC

"Sascha Kerschhofer" <sk**********@yahoo.de> wrote in message
news:bf**********@news.mch.sbs.de...
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
Jul 20 '05 #6
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.

Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: The Plankmeister | last post by:
If I set a border value to something like: border : thin solid blue; It will look perfect in all browsers except IE (No surprise there) where 'thin' borders are rendered 2 pixels wide. If I...
0
by: C | last post by:
Hi I am relatively new to .NE My backrgound is VB6, ASP and COM I understand that COM is scaleable through MTS etc In .NET when I create say a web project and create an Assembly that is...
8
by: One More Try | last post by:
Not to start a flame war here, but I really would like to know if someone did a comparison of Java to dotnet, and what the benefits (pros and cons) each development environment has. Since I have...
17
by: eric.nave | last post by:
What is the correct way to find all the form elements in a particular div? I'd like to be able to loop through them and disable them. For example: <form> <div id="div1"> <input type=text...
1
by: Lucas Fletcher | last post by:
Hi All, I've searched the web for an article explaining the many tradeoffs between storing your XML in a database vs the filesystem but I haven't really found anything of note. This is the...
6
by: nichughes | last post by:
Hello all, A question relating to http://www.entrust-systems.net/ Just for a change I have run into a problem that seems to be OS specific rather than browser specific - the box image that is...
6
by: webmaster | last post by:
Is there a way to have the image shrink when the viewer is using a sidebar? In other words, the page has three columns, two small columns on each side that are navigation and information , while...
2
by: jsqrd | last post by:
Does anyone now if the ubiquitous "scaleable naviagtion pane" as used on the MSDN Library site (http://.msd2.microsoft.com...) is a custom control? If not, where it can be found? Thanks, JJ
20
by: gremlin | last post by:
http://www.cilk.com/multicore-blog/bid/6703/C-Inventor-Bjarne-Stroustrup-answers-the-Multicore-Proust-Questionnaire
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.