Merges different PDF files into single PDF

Namespace:  SautinSoft
Assembly:  SautinSoft.PdfVision (in SautinSoft.PdfVision.dll) Version:


 C#  Visual Basic 
public byte[] MergePDFFileArrayToPDFStream(
	string[] Files
Public Function MergePDFFileArrayToPDFStream ( _
	Files As String() _
) As Byte()


array< String >[]()[]
Array with paths to PDF documents

Return Value

Single PDF document as byte array - in case of merging successfully
null - in case of merging failed


CopyHow to merge PDF in memory using C#
using System;
using System.IO;
using System.Collections.Generic;

namespace Sample
    class Test

        static void Main(string[] args)

            //Merge PDF in memory
            SautinSoft.PdfVision v = new SautinSoft.PdfVision();
            //v.Serial = "XXXXXXXXXXXXXXX";

            //merge 4 PDF files
            string[] pdfFilesArr = new string[4];
            pdfFilesArr[0] = @"c:\document1.pdf";
            pdfFilesArr[1] = @"c:\document2.pdf";
            pdfFilesArr[2] = @"c:\document3.pdf";
            pdfFilesArr[3] = @"c:\document4.pdf";

            FileInfo singlePdf = new FileInfo("single.pdf");

            List<byte[]> pdfInventory = new List<byte[]>();

            // Fill the pdfBytesList.
            foreach (string pdfFile in pdfFilesArr)

            byte[] pdfBytes = v.MergePDFStreamArrayToPDFStream(pdfInventory);

            if (pdfBytes != null)
                File.WriteAllBytes(singlePdf.FullName, pdfBytes);
CopyHow to merge PDF in memory using VB.Net
Imports System.IO

Namespace Sample
    Friend Class Test

        Shared Sub Main(ByVal args() As String)
            'Merge PDF in memory
            Dim v As New SautinSoft.PdfVision()
            'v.Serial = "XXXXXXXXXXXXXXX";

            'merge 4 PDF files
            Dim pdfFilesArr(3) As String
            pdfFilesArr(0) = "c:\document1.pdf"
            pdfFilesArr(1) = "c:\document2.pdf"
            pdfFilesArr(2) = "c:\document3.pdf"
            pdfFilesArr(3) = "c:\document4.pdf"

            Dim singlePdf As New FileInfo("single.pdf")

            Dim pdfInventory As New List(Of Byte())()

            ' Fill the pdfBytesList.
            For Each pdfFile As String In pdfFilesArr
            Next pdfFile

            Dim pdfBytes() As Byte = v.MergePDFStreamArrayToPDFStream(pdfInventory)

            If pdfBytes IsNot Nothing Then
                File.WriteAllBytes(singlePdf.FullName, pdfBytes)
            End If
        End Sub
    End Class
End Namespace

See Also