Merges different PDF files into single PDF file

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

Syntax

      
 C#  Visual Basic 
public int MergePDFFileArrayToPDFFile(
	string[] Files,
	string DestFile
)
Public Function MergePDFFileArrayToPDFFile ( _
	Files As String(), _
	DestFile As String _
) As Integer

Parameters

Files
array< String >[]()[]
Array with paths to PDF documents
DestFile
String
Path to a new single PDF, it will be created by the component or overwritten in case of PDF is already exist

Return Value

0 - merged successfully
1 - error, can't merge PDF documents
2 - error, can't create output file, probably it used by another application
3 - merging failed
4 - merged successfully, but some files were not merged

Examples

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


namespace Sample
{
    class Test
    {
        static void Main(string[] args)
        {
            // Merge PDF files.
            SautinSoft.PdfVision v = new SautinSoft.PdfVision();

            //v.Serial = "XXXXXXXXXXXXXXX";

            // Let's merge several PDF files.
            string[] inpFiles = new string[] { @"..\..\simple text.pdf", @"..\..\table.pdf" };
            string outFile = "Merged.pdf";

            int ret = v.MergePDFFileArrayToPDFFile(inpFiles, outFile);

            // 0 - Merged successfully.
            // 1 - Error, can't merge PDF documents.
            // 2 - Error, can't create the output file, probably it used by another application.
            // 3 - Merging failed.
            // 4 - Merged successfully, but some files were not merged.
            if (ret == 0)
            {
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
            }
        }
    }
}
CopyHow to merge PDF files in VB.Net
Imports System
Imports System.IO
Imports System.Collections


Namespace Sample
    Friend Class Test
        Shared Sub Main(ByVal args() As String)
            ' Merge PDF files.
            Dim v As New SautinSoft.PdfVision()

            'v.Serial = "XXXXXXXXXXXXXXX"


            ' Let's merge several PDF files.
            Dim inpFiles() As String = { "..\..\simple text.pdf", "..\..\table.pdf" }
            Dim outFile As String = "Merged.pdf"

            Dim ret As Integer = v.MergePDFFileArrayToPDFFile(inpFiles, outFile)

            ' 0 - Merged successfully.
            ' 1 - Error, can't merge PDF documents.
            ' 2 - Error, can't create the output file, probably it used by another application.
            ' 3 - Merging failed.
            ' 4 - Merged successfully, but some files were not merged.
            If ret = 0 Then
                System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True})
            End If
        End Sub
    End Class
End Namespace

See Also