-
Notifications
You must be signed in to change notification settings - Fork 257
Duplicate and Cloneing pages from one document to another #299
Hi,
What is the best way to duplicate several copies of a page from a document to another document (new document contains two copies of the first page of the first document)?
I'm using v6.1.1
I'm trying with
Doc.AddPage((PdfPage)oldDoc.Pages[0].Clone());
but it throws an error: "An item with the same key has already been added"
Doc.AddPage(oldDoc.Pages[0]);
gives the same error (although from the documentation page it sounds like AddPage(page) should create a copy of the page and Clone() shouldn't be necessary. )
perhaps when Doc.AddPage(page) is called the page id or something wasn't updated? how can I update the key?
or maybe I am approaching is completely wrong?
Also would like to ask if it is possible to draw something under the duplicated pages, these will be different on each copies of the page.
Thank you!
All reactions
Replies: 1 comment
Hi!
Copying pages to other files works generally. There may be something special about the page you try to copy.
I cannot tell, seeing just one line of code.
Pages can be modified after copying them.
Pages can be drawn on other pages along with new content.