Closed OldTangN closed 5 years ago
@OldTangN
Element cannot be created from incomplete XML text. So, follow steps below.
var svgTextHeader = @"<?xml version='1.0' encoding='utf-8'?>
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='default' width='400' height='400'>";
var svgTextFooter = @"</svg>";
// Path
var strPath = @"<path transform=""translate(-20,0)"" fill-rule=""evenodd"" clip-rule=""evenodd"" fill=""none"" stroke=""#000000"" stroke-width=""1.4173"" stroke-miterlimit=""2.4142"" d=""
M217.274,209.852c4.294,0,7.796,3.502,7.796,7.795c0,4.295-3.502,7.797-7.796,7.797s-7.795-3.502-7.795-7.797
C209.479,213.354,212.98,209.852,217.274,209.852L217.274,209.852z""/>";
var docWithPath = SvgDocument.FromSvg<SvgDocument>(new StringBuilder(svgTextHeader).Append(strPath).Append(svgTextFooter).ToString());
// Add Path
doc.Children.Add(docWithPath.Children[0].DeepCopy());
@H1Gdev Thank you very much.
Description
I want add a SvgPath to the document, can i convert from a string ?
Example data
string strPath = @"<path transform=""translate(-20,0)"" fill-rule=""evenodd"" clip-rule=""evenodd"" fill=""none"" stroke=""#000000"" stroke-width=""1.4173"" stroke-miterlimit=""2.4142"" d="" M217.274,209.852c4.294,0,7.796,3.502,7.796,7.795c0,4.295-3.502,7.797-7.796,7.797s-7.795-3.502-7.795-7.797 C209.479,213.354,212.98,209.852,217.274,209.852L217.274,209.852z""/>";
Used Versions