The file path of the first PDF document to merge.
The file path of the second PDF document to merge.
The file path of the destination PDF document.

Please ensure that the destination file path differs from both source file paths.

Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / Merge2Documents Method / Merge2Documents(String,String,String) Method

Merge2Documents(String,String,String) Method

In This Topic
Merges two PDF documents according to their file paths. The resulting PDF document is saved to a file path you have specified. If the specified file already exists, it will be overwritten. Please see also the Merge2Documents(GdPicturePDF,GdPicturePDF) method for more details.

Just to inform you, that the toolkit offers the adaptive file caching mechanism to significantly reduce memory usage while merging large documents. The feature is available in both 32-bit and 64-bit mode by default.

Syntax
'Declaration
 
Public Overloads Function Merge2Documents( _
   ByVal SrcDoc1 As String, _
   ByVal SrcDoc2 As String, _
   ByVal DstDoc As String _
) As GdPictureStatus
public GdPictureStatus Merge2Documents( 
   string SrcDoc1,
   string SrcDoc2,
   string DstDoc
)
public function Merge2Documents( 
    SrcDoc1: String;
    SrcDoc2: String;
    DstDoc: String
): GdPictureStatus; 
public function Merge2Documents( 
   SrcDoc1 : String,
   SrcDoc2 : String,
   DstDoc : String
) : GdPictureStatus;
public: GdPictureStatus Merge2Documents( 
   string* SrcDoc1,
   string* SrcDoc2,
   string* DstDoc
) 
public:
GdPictureStatus Merge2Documents( 
   String^ SrcDoc1,
   String^ SrcDoc2,
   String^ DstDoc
) 

Parameters

SrcDoc1
The file path of the first PDF document to merge.
SrcDoc2
The file path of the second PDF document to merge.
DstDoc
The file path of the destination PDF document.

Please ensure that the destination file path differs from both source file paths.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
You have to specify a full file path for the destination document with the correct file extension, which is "pdf". Likewise it is required, that the destination file path differs from both source file paths.

You don't need to load any document within the GdPicturePDF object you are going to use. You can simply use it as an empty wrapper object, as it is shown in the example below.

Example
How to merge two PDF documents using their file paths into a PDF document specified by its file path.
Using gdpicturePDF As New GdPicturePDF()
    Dim status As GdPictureStatus = gdpicturePDF.Merge2Documents("test1.pdf", "test2.pdf", "test_merged.pdf")
    If status = GdPictureStatus.OK Then
        MessageBox.Show("Both documents have been successfully merged.", "Example: Merge2Documents")
    Else
        MessageBox.Show("The Merge2Documents() method has failed with the status: " + status.ToString(), "Example: Merge2Documents")
    End If
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
    GdPictureStatus status = gdpicturePDF.Merge2Documents("test1.pdf", "test2.pdf", "test_merged.pdf");
    if (status == GdPictureStatus.OK)
    {
        MessageBox.Show("Both documents have been successfully merged.", "Example: Merge2Documents");
    }
    else
    {
        MessageBox.Show("The Merge2Documents() method has failed with the status: " + status.ToString(), "Example: Merge2Documents");
    }
}
See Also