Merge two PDF documents

Docotic.Pdf Library Help > Samples > General operations > Merge two PDF documents

This sample shows how to append an existing PDF document to the end of your current document using PdfDocument.Append method.

C# 
using System.Diagnostics;

namespace BitMiracle.Docotic.Pdf.Samples
{
    public static class MergeDocuments
    {
        public static void Main()
        {
            // NOTE: 
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "MergeDocuments.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                pdf.Open("Sample data/form.pdf");
                pdf.Append("Sample data/jfif3.pdf");

                pdf.Save(pathToFile);
            }

            Process.Start(pathToFile);
        }
    }
}
Visual Basic 
Imports System.Diagnostics

Imports BitMiracle.Docotic.Pdf

Namespace BitMiracle.Docotic.Pdf.Samples
    Public NotInheritable Class MergeDocuments
        Public Shared Sub Main()
            ' NOTE: 
            ' When used in trial mode, the library imposes some restrictions.
            ' Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            ' for more information.

            Dim pathToFile As String = "MergeDocuments.pdf"

            Using pdf As New PdfDocument()
                pdf.Open("Sample data/form.pdf")
                pdf.Append("Sample data/jfif3.pdf")

                pdf.Save(pathToFile)
            End Using

            Process.Start(pathToFile)
        End Sub
    End Class
End Namespace