Show
In HTML, it looks better to display svg,<object> than <embed>, because when the SVG size is too large,,<object> will only scale, and <embed> will crop the image off
Is the so-called: both Raw Yu, He Senliang. But <object> is a more informal label than <embed>!
If your SVG needs to be seen by more people, then using <embed> is a good choice!
It's simple, we can read the width,height! from SVG.
Because SVG is also in XML format, it is much easier!
<%@ import namespace= "System.Xml"%> don't forget to import the appropriate namespaces
The method is as follows: The role of the corresponding function I do not elaborate, the. NET Framework has a detailed description
Sub Showsvgwindow (Thesvgpath as String)
Dim reader As XmlTextReader = Nothing
Dim nodeattribtion As New ArrayList ()
Dim i,width,height As Integer
reader = new XmlTextReader (server. MapPath (Thesvgpath))
Dim exp As Exception
Try
While reader. Read ()
If Reader. NodeType = XmlNodeType.Element and reader. Name = "svg" Then
If Reader. HasAttributes Then
For i = 0 to (reader.attributecount-1)
Reader.movetoattribute (i)
If Reader. Name = "width" Then
width = reader. Value
End If
If Reader. Name = "height" Then
Height = reader. Value
End If
Next
End If
Exit while
End If
End While
Catch EXP
End Try
If CInt (width) < Then
width = "50"
Else If CInt (height) < Then
Height = "50"
End If
Svgwindow.text = "<embed src=" & Thesvgpath & "height=" & height & "px width=" & Width & PX&G T;</embed> "
Svgtitle.text = Request. QueryString ("title")
End Sub