merge 2 svg, position issue #1051
-
Hello everyone, I don't understand why i can't change position of my second svg
if somehone can help me, thanks a lot Thomas |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
var doc = new SvgDocument();
var group = new SvgGroup();
doc.Children.Add(group);
var qrO = SvgDocument.Open(@"qr.svg");
var qr = (SvgFragment)qrO.DeepCopy<SvgFragment>(); // Optional this time.
qr.Width = 300;
qr.Height = 300;
var logoO = SvgDocument.Open(@"logoI.svg");
var logo = (SvgFragment)logoO.DeepCopy<SvgFragment>();
logo.Width = 50;
logo.Height = 50;
logo.X = 125;
logo.Y = 125;
group.Children.Add(qr);
group.Children.Add(logo);
doc.Write(@"importtest.svg");
|
Beta Was this translation helpful? Give feedback.
-
If cost of copying is high, there is also method of increasing one layer. var logoO = SvgDocument.Open(@"logoI.svg");
//var logo = (SvgFragment)logoO.DeepCopy<SvgFragment>();
var logo = new SvgFragment();
logo.Children.Add(logoO);
logo.Width = 50;
logo.Height = 50; |
Beta Was this translation helpful? Give feedback.
-
Third plan. var logoO = SvgDocument.Open(@"logoI.svg");
//var logo = (SvgFragment)logoO.DeepCopy<SvgFragment>();
var logo = new SvgFragment();
foreach (var element in logoO.Children)
logo.Children.Add(element);
logo.Width = 50;
logo.Height = 50; |
Beta Was this translation helpful? Give feedback.
-
Hi H1Gdev, thanks a lot for your help, your solutions are ok for me. No cost time in my case so first solution is perfect Thomas |
Beta Was this translation helpful? Give feedback.
SvgDocument
has characteristics of root <svg>.So
X
,Y
properties do not work.By duplicating
SvgFragment
fromSvgDocument
, it can be inner <svg>.