|
Hello.
We are som students trying to use SvgNet in asp.net to generate a svg picture´.. But it isnt working. we are using an Embed tag inside the asp.net page like this:
<embed src="SvgTest.aspx" type="image/svg+xml" ginspage="http://www.adobe.com/svg/viewer/install/" />
Below, the code for page load method of SvgTest.aspx.cs
Response.Clear();
SvgSvgElement root = new SvgSvgElement("4in", "4in", "0,0 100,100");
root.AddChildren(
new SvgRectElement(5, 5, 10, 10),
new SvgEllipseElement(30, 10, 8, 12),
new SvgTextElement("PINGU!", 10, 40)
);
string s = root.WriteSVGString(true);
Response.ContentType = "image/svg+xml";
Response.Write(s);
Maybe someone can tell us how this actuallly work??
Regards, micke.
|
|
|
|
|
Hi,
im new to learning svg. i open the project svgdoctest. im trying to run the SvgDocTest but compiler is giving many errors. ive already installed adobe svg viewer. below are the errors given:-
a) line 0 = missing file specification for 'lr' command-line option(CS2005)
b) line 33,34,35 = the type/namespace name 'SvgNet' could not be found(are
you missing directive or an assembly reference?)(CS0246)
c) line 50,51 = the type/namespace name 'AxSVGACTIVEXLib' could not be found
(are you missing directive or an assembly reference?)(CS0246)
d) line 220 = the type/namespace name 'SvgElement' could not be found
(are you missing directive or an assembly reference?)(CS0246)
e) line 67 = TODO Add any constuctor code after InitializeComponent call
please help me solve this as im doing a project regarding svgnet.
.:MaryAnne:.
|
|
|
|
|
You need to install the Adobe SVG viewer; that's what AxSVGACTIVEXLib is.
The demo/test applications use this to display svg to verify that it looks right. You don't need it for the actual SvgNet library itself, though.
This seems to be a very FAQ, so I will put something about it in the article itself.
URL: http://www.jbrowse.com
Favorite Toy: http://www.ruby-lang.org
|
|
|
|
|
first,I should say sorry for my poor english!
i got a wrong message here:
svgCtl.SRC = "c:\\temp\\foo.svg";
please tell me why?
i'm learning svg now
who can help me?
|
|
|
|
|
I found the wrong message too!
svgCtl.SRC="c:\\temp\\foo.svg";
Please tell me why ?
MSN:cxymxh@hotmail.com
|
|
|
|
|
Hello. im nab from japan. I
sorry my english is poor. i hope u can understand.
i love svgnet and using it.but...
i have a question about how to use svgnet.
i want to make SVG file. like this.
-------------------------------------------------------------
<svg width="12cm" height="10cm">
<rect x="2cm" y="2cm" width="8cm" height="6cm" rx="50" ry="50" fill="blue" stroke="blue">
<svg width="12cm" height="10cm">
<rect x="2cm" y="2cm" width="8cm" height="6cm" rx="100" ry="50" fill="red" stroke="blue">
--------------------------------------------------------------
this file has two svg tag.
is it possible to make this SVG File in SVGnet?
please help me.
|
|
|
|
|
i want to make SVG file. like this.
please teach me how to write in C# that use svgnet's DLL.
------------------------------------
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="12cm" height="10cm">
<rect x="2cm" y="2cm" width="8cm" height="6cm" rx="50" ry="50" fill="blue" stroke="blue"/>
<svg width="12cm" height="10cm">
<rect x="2cm" y="2cm" width="8cm" height="6cm" rx="100" ry="50" fill="red" stroke="blue"/>
</svg>
</svg>
|
|
|
|
|
You should be able to do it just by doing
SvgSvgElement rootDoc = new SvgSvgElement();
SvgSvgElement subDoc = new SvgSvgElement();
rootDoc.AddChild(subDoc);
...unless I am forgetting something?
URL: http://www.jbrowse.com
Favorite Toy: http://www.ruby-lang.org
|
|
|
|
|
Hi!Ben
Thanks for help.
plz help me more.I got confused.
I try to make a SVG File that has two <svg> using svgnet.
like this↓
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"[
<!ENTITY E2 'fill:rgb(0,0,255);stroke:none;opacity:1;'>
<!ENTITY E1 'fill:rgb(255,0,0);stroke:none;opacity:1;'>
]>
<svg id="SvgGdi_output"> <!-- first svgtag--!>
<rect id="background" style="fill:rgb(236,233,216);" width="100%" height="100%" x="0" y="0" />
<g id="root_group" style="shape-rendering:crispEdges;">
<rect id="4" style="&E1;" width="100" height="200" x="8" y="8" />
</g>
<defs id="clips_hatches_and_gradients" />
<svg id ="hoge"> <!-- second svgtag--!>
<g id="root_group2" style="shape-rendering:crispEdges;">
<rect id="5" style="&E2;" width="50" height="100" x="8" y="8" />
</g>
<defs id="clips_hatches_and_gradients" />
</svg>
</svg>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
how should I write the code?
-------------------------------------------
SvgGraphics ig;
ig = new SvgGraphics();
ig.FillRectangle(new SolidBrush(Color.Red),8,8,100,200);
//---how should i write a code? i wanna insert svgtag more in SVGFile--
xxx.FillRectangle(new SolidBrush(Color.Blue),8,8,50,100);
//----
string s = ig.WriteSVGString();
StreamWriter tw = new StreamWriter("c:\\temp\\foo.svg", false);
tw.Write(s);
tw.Close();
svgCtl.SRC = "c:\\temp\\foo.svg";
-------------------------------------------
plz help me again.
thank u for reading my english. u know my English is too poor.
|
|
|
|
|
Hi!Ben
Thanks for help.
plz help me more.I got confused.
I try to make a SVG File that has two <svg> using svgnet.
like this↓
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"[
<!ENTITY E2 'fill:rgb(0,0,255);stroke:none;opacity:1;'>
<!ENTITY E1 'fill:rgb(255,0,0);stroke:none;opacity:1;'>
]>
<svg id="SvgGdi_output"> <!-- first svgtag--!>
<rect id="background" style="fill:rgb(236,233,216);" width="100%" height="100%" x="0" y="0" />
<g id="root_group" style="shape-rendering:crispEdges;">
<rect id="4" style="&E1;" width="100" height="200" x="8" y="8" />
</g>
<defs id="clips_hatches_and_gradients" />
<svg id ="hoge"> <!-- second svgtag--!>
<g id="root_group2" style="shape-rendering:crispEdges;">
<rect id="5" style="&E2;" width="50" height="100" x="8" y="8" />
</g>
<defs id="clips_hatches_and_gradients" />
</svg>
</svg>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
how should I write the code?
-------------------------------------------
SvgGraphics ig;
ig = new SvgGraphics();
ig.FillRectangle(new SolidBrush(Color.Red),8,8,100,200);
//---how should i write a code? i wanna insert svgtag more in SVGFile--
xxx.FillRectangle(new SolidBrush(Color.Blue),8,8,50,100);
//----
string s = ig.WriteSVGString();
StreamWriter tw = new StreamWriter("c:\\temp\\foo.svg", false);
tw.Write(s);
tw.Close();
svgCtl.SRC = "c:\\temp\\foo.svg";
-------------------------------------------
plz help me again.
thank u for reading my english. u know my English is too poor.
|
|
|
|
|
Ah, you can create nested svg elements via the svgnet api, but not via the SvgGraphics class. This is because there is no GDI+ structure which needs to be represented by nested svg elements.
The SvgGraphics class is there so that you can create svg documents in the same way as drawing to a GDI+ Graphics object. If you just want to create an svg document, you can just create some SvgElement-derived objects and use 'AddChild' on them to build up a scene.
URL: http://www.jbrowse.com
Favorite Toy: http://www.ruby-lang.org
|
|
|
|
|
Hi! Ben
I understand.
Im going to create nested svg element via the svgnet api.
thank u very much.
|
|
|
|
|
VG.net is more component oriented.
check out VG.net: www.vgdotnet.com
An animated vector graphics system integrated in VS.net
|
|
|
|
|
Hi!Frank.
thanks for good info.
I Checked out.I respect you.
VG.net is great and so cool!
I wanna use very much.;P
but It's hard to get it in Japan.
how can i get it?
Im Japanese and I love SVG.
but..still SVG is not common in japan.
----------------------
ikarosu
nab0320@yahoo.co.jp
----------------------
|
|
|
|
|
Hello,
First off, thank-you for this nice piece of work!
I need some advice on WriteSVGString(). I have modified the SvgGdiTest to do draw some line segments and am getting some unexpected results although the generated SVG file is well formed and renders properly.
I have an application where I need to render some line segments. (Actually it is a four channel waveform). Three ways to do this in GDI+ are to use DrawLine, DrawLines or DrawPolygon. Using SvgNet with either ig.DrawLines or ig.DrawPolygon, the ig.WriteSVGString() takes ~18 seconds to create the string. The resulting output is a small ~60k file, although it renders correctly.
Pen p = new Pen(Color.Red);
PointF [] pt = new PointF[10000];
for(int i= 0; i<10000; i++)
{
pt[i].X= 0;
pt[i].Y= i;
}
ig.DrawLines( p, pt );
string s = ig.WriteSVGString();
write to a file....
If I use ig.DrawLine to render the data (below), ig.WriteSVGString() takes ~1 second to create the string, but creates a monster ~650K file. Again, the SVG renders correctly.
PointF [] pt = new PointF[10000];
for(int i= 0; i<10000; i++)
{
ig.DrawLine( p, 0,0, 0, i );
}
string s = ig.WriteSVGString();
write to a file....
Am I missing something here? It seems that DrawLines or DrawPolygon should more efficient and execute almost instantaneous. Perhaps there is a different way?
John Hoffman
|
|
|
|
|
I would appreciate advice on your project and saving editable vectors.
I am trying to save a set of poly-lines (straight-segmented-lines) to an industry-standard file format which will allow subsequent editing of the lines. The program I am developing is written in C# on .NET. Which file formats are appropriate (SVG/DXF?) and would this project help with the job?
Many thanks for any help.
Best regards,
Nicholas Lim
Technical Architect ICraftSolutions Ltd
|
|
|
|
|
(I forget whether I already replied to this by mail, and you have probably solved the problem already, but...)
I think SVG is probably a suitable format for that task. It doesn't take up too much space and it can be visually edited by many GUI tools. SVG can represent polylines with the 'path' element, which allows for curved segments, but if you know you only ever need straight polylines you can use the 'polyline' element.
SvgNet wraps these elements with the SvgPolylineElement object. This object has a 'points' property that holds an SvgPoints object, so you can specify the points with strings or numeric arrays thus:
SvgPolylineElement mypoly("3,4 5,6 7,8");
mypoly.Points = "23,45 24,45 24,46 24.5,46.5";
mypoly.Points = new float[]{23,45,24,45,24,46,24.5,46.5};
...and so on.
On the other hand if all you want to do is store polylines it would be pretty easy to just to write out the svg manually:
<svg>
<polyline points="23,45 24,45 24,46 24.5,46.5">
<polyline points="906,3 907,3 908,3 909,1003">
...and so on.
URL: http://www.jbrowse.com
Favorite Toy: http://www.ruby-lang.org
|
|
|
|
|
Ben,
Many thanks for your reply - it is of great help. Would you be able to clarify two points you made?
Where you say: "it (SVG) can be visually edited by many GUI tools"
QU: could you recommend some proven SVG CAD-style GUI tools, that could handle up to 5,000 polylines? I need to display, scroll, zoom, and edit the lines by adding points, eventually maybe merging lines etc., all displayed against a background image.
Where you say:
"On the other hand if all you want to do is store polylines it would be pretty easy to just to write out the svg manually:
...and so on."
QU: the detail before the "and so on" did not show up. Had you included a code snippet?
Many thanks again for your help.
Best,
Nick
|
|
|
|
|
|
Adobe Illustrator
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
InkScape
Cheers,
Greg
------------------
"People do what they want to do."
|
|
|
|
|
I was trying to use Scalable Vector Graphics.
it gives me following error.
"The type or namespace name 'AxSVGACTIVEXLib' could not be found (are you missing a using directive or an assembly reference?)"
where do i get the lib. from .?
thanks
Paresh
|
|
|
|
|
You need to install the Adobe SVG viewer; that's what AxSVGACTIVEXLib is.
The demo/test applications use this to display svg to verify that it looks right. You don't need it for the actual SvgNet library itself, though.
URL: http://www.jbrowse.com
Favorite Toy: http://www.ruby-lang.org
|
|
|
|
|
Hello,
Thank for the contribution. There is another effort here.
BTW, one or two screenshots will be done me some good
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|