Merges different PDF files into single PDF file

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

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";

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

            int ret = v.MergePDFFileArrayToPDFFile(files, @"c:\hardcopy.pdf");

            //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
            if (ret == 0)
            {
                System.Diagnostics.Process.Start(@"c:\hardcopy.pdf");
            }
        }
    }
}
CopyHow to merge PDF files in VB.Net
Imports System.IO

Namespace Sample
    Friend Class Test

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


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

            Dim ret As Integer = v.MergePDFFileArrayToPDFFile(files, "c:\hardcopy.pdf")

            '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
            If ret = 0 Then
                System.Diagnostics.Process.Start("c:\hardcopy.pdf")
            End If
        End Sub
    End Class
End Namespace

See Also