PdfDocumentEditor editor = new PdfDocumentEditor("file1.pdf");
// Attach all content of file2.pdf to the end of file1.pdf
editor.Merge("file2.pdf");
editor.Save("result.pdf");
editor.Close();
Operation of PdfDocumentEditor is accumulative
using (PdfDocumentEditor pdfEditor = new PdfDocumentEditor(GetFile("file1.pdf")))
{
// Insert page 0 and 1 from file2.pdf before 2nd page of file1.pdf
pdfEditor.Insert(1, "file2.pdf", new int[] { 0, 1 });
// Insert page 2 and 3 from file2.pdf before 5th page of the new pdf file represent by pdfEditor object
pdfEditor.Insert(5, "file2.pdf", new int[] { 2, 3 });
// Append whole file of file3.pdf at the end of the new pdf file object represent by pdfEditor object
pdfEditor.Merge("file3.pdf");
// Append page 0 to 4 from file4.pdf to the new pdf file object represent by pdfEditor object
pdfEditor.Append("file4.pdf", 0, 4);
pdfEditor.Save("Insert_Merge_Append.pdf");
pdfEditor.Close();
}