Link Search Menu Expand Document

Merge Two PDF Documents - C#

PDF SDK sample in C# demonstrating ‘Merge Two PDF Documents’

using System.Diagnostics;
using Bytescout.PDF;

namespace CopyPagesFromOneDocumentToAnother
    class Program
        static void Main(string[] args)
            // Open first document
            Document document1 = new Document("document1.pdf");
            document1.RegistrationName = "demo";
            document1.RegistrationKey = "demo";
            // Open second document
            Document document2 = new Document("document2.pdf");
            document2.RegistrationName = "demo";
            document2.RegistrationKey = "demo";
            // Append document2 to document1
            // Save merged document

            // Open result document in default associated application (for demo purpose)
            ProcessStartInfo processStartInfo = new ProcessStartInfo("MergedDocument.pdf");
            processStartInfo.UseShellExecute = true;

Download Source Code (.zip)

Return to the previous page Explore PDF SDK