Skip to content

merge 2 svg, position issue #1051

Answered by H1Gdev
Noeilnoeil17 asked this question in Q&A
Discussion options

You must be logged in to vote
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");

SvgDocument has characteristics of root <svg>.
So X, Y properties do not work.
By duplicating SvgFragment from SvgDocument, it can be inner <svg>.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Noeilnoeil17
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mrbean-bremen
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants