Hello Prashant,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
There are two approaches to accomplish your requirement.
1st - Split both the pdf files into single page documents, and create the resultant pdf, in a sequence of pages according to your requirement.
2nd - Extract specific pages from both the pdf files, and save them as separate files, and than merge them through Insert method of PdfFileEditor class. In this method you can only specify the location where you can insert the pages & the number of pages to be inserted. Following code snippet is based over this scenario
int[] pages1 = new int[] { 1, 3}; // Pages to be extracted from First file (pdf with 4 pages)
PdfFileEditor pdfEditor = new PdfFileEditor();
pdfEditor.Extract(@"C:\Temp\4Page.pdf", pages1, @"C:\Temp\Extract\First_Third_page.pdf"); //Extract page 1 & 3 from 1st pdf, and save as a separate pdf file.
int[] pages2 = new int[] { 2, 3}; // Pages to be extracted from Second file (pdf with 5 pages)
pdfEditor.Extract(@"C:\Temp\5Page.pdf", pages2, @"C:\Temp\Extract\Second_Third_page.pdf"); // Extract page 2 & 3 from 1st pdf, and save as a separate pdf file.
// Now we need to merge both the pdf files. We will insert 2 pages from 2nd file into 1st pdf at location 1.
int[] pages = new int[] { 1, 2 }; // Number of Pages to be inserted from 2nd pdf
pdfEditor.Insert(@"C:\Temp\Extract\First_Third_page.pdf", 1, @"C:\Temp\Extract\Second_Third_page.pdf", pages, @"c:\Temp\extract\FinalConcatenated.pdf"); // The Final concatenated pdf will have 4 pages with sequence like, Page 1 from 1st pdf, Page2 & Page 3 from 2nd Pdf, and Page 3 from 1st Pdf