EVO HTML to PDF Converter

Merge PDF Documents

EVO PDF Client for .NET Documentation
Code Sample - Merge PDF Documents

C#
protected void mergePdfButton_Click()
{
    // Get the server IP and port
    String serverIP = textBoxServerIP.Text;
    uint serverPort = uint.Parse(textBoxServerPort.Text);

    // Create the merge result PDF document
    Document mergeResultPdfDocument = null;
    if (radioButtonUseTcpService.Checked)
        mergeResultPdfDocument = new Document(serverIP, serverPort);
    else
        mergeResultPdfDocument = new Document(true, textBoxWebServiceUrl.Text);

    // Set optional service password
    if (textBoxServicePassword.Text.Length > 0)
        mergeResultPdfDocument.ServicePassword = textBoxServicePassword.Text;

    // Set license key received after purchase to use the converter in licensed mode
    // Leave it not set to use the converter in demo mode
    mergeResultPdfDocument.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c=";

    // Load the first PDF document to merge
    string firstPdfFilePath = Server.MapPath("~/DemoAppFiles/Input/PDF_Files/Merge_Before_Conversion.pdf");
    // Merge the first PDF document
    mergeResultPdfDocument.AppendDocument(firstPdfFilePath);

    // Load the second PDF document to merge
    string secondPdfFilePath = Server.MapPath("~/DemoAppFiles/Input/PDF_Files/Merge_After_Conversion.pdf");
    // Merge the second PDF document
    mergeResultPdfDocument.AppendDocument(secondPdfFilePath);

    // Save the merge result PDF document in a memory buffer
    byte[] outPdfBuffer = mergeResultPdfDocument.Save();
}