Sales
1-888-9DOTNET
|
To merge two PDF document, pages of one document should be added with other document by using the Add method. Please refer the below code snippet which illustrates this: C# //Load first document PDFDocument pdfDoc1 = new PDFDocument(@"..\..\Data\Sample1.pdf"); //Load other document PDFDocument pdfDoc2 = new PDFDocument(@"..\..\Data\Sample2.pdf"); //Merge for (int i = 0; i < pdfDoc1.Pages.Count; i++) { pdfDoc2.Pages.Add(pdfDoc1.Pages[i]); } VB 'Load first document Private pdfDoc1 As PDFDocument = New PDFDocument("..\..\Data\Sample1.pdf") 'Load other document Private pdfDoc2 As PDFDocument = New PDFDocument("..\..\Data\Sample2.pdf") 'Merge Dim i As Integer = 0 Do While i < pdfDoc1.Pages.Count pdfDoc2.Pages.Add(pdfDoc1.Pages(i)) i += 1 Loop Sample: http://websamples.syncfusion.com/samples/KB/PDF.Windows/PMerging/main.htmNote: This will work only with PDF.Legacy.Base |