We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Eror getting one pdf into another pdf at specific page no

Dear Syncfusion,
I want to load a pdf into another pdf at specific no. That is, if the current pdf has 11 page and another pdf has 3 page, I want to add second pdf to first pdf at page no 3.
My code is:


documentLoaded = new PdfLoadedDocument(pathTemporaryPdf);

PdfLoadedDocument loadedDocumentToBeAdded = new PdfLoadedDocument(filePathFull);

int pageNumber = 3;

for (int i =0; i < loadedDocumentToBeAdded.Pages.Count; i++){

var page = loadedDocumentToBeAdded.Pages[i];

documentLoaded.Pages.Insert(pageNumber + i, page);

}

it is creating an error:
An item with the same key has already been added

Can anybody help me?




1 Reply

SL Sowmiya Loganathan Syncfusion Team October 5, 2017 10:58 AM UTC

Hi Deb, 

We have tried with sample in our side with the code snippet provided by you. We regret to let you know that we could not reproduce the issue with “Inserting one PDF into another PDF at specific page number”.  

Please find the sample from below link :  

We suspect this to be a document specific issue. Please share the input document we will analyze and update you with further information. 

Regards, 
Sowmiya L 


Loader.
Live Chat Icon For mobile
Up arrow icon