Table of Contents

Class PdfMergeOptions

Namespace
Syncfusion.Pdf
Assembly
Syncfusion.Pdf.Portable.dll

Represents to customize the support of merging PDF documents.

public class PdfMergeOptions
Inheritance
PdfMergeOptions
Inherited Members

Examples

// Destination PDF document
PdfDocument destDoc = new PdfDocument();
// Source PDF documents
string[] source = { "Src1.pdf", "Src2.pdf" };
PdfMergeOptions option = new PdfMergeOptions();
option.OptimizeResources = true;
//Merge the source pdf document.
PdfDocumentBase.Merge(destDoc, option, source);
destDoc.Save("Merge.pdf");
' Destination PDF document
Dim destDoc As PdfDocument = New PdfDocument()
' Source PDF documents
Dim source() As String = { "Src1.pdf", "Src2.pdf" }
'Merge the source pdf document.
Dim [option] As PdfMergeOptions = New PdfMergeOptions()
[option].OptimizeResources = True
PdfDocumentBase.Merge(destDoc, [option], source)
destDoc.Save("Merge.pdf")

Constructors

PdfMergeOptions()

public PdfMergeOptions()
See Also

Properties

ExtendMargin

When ExtendMargin is set to true, then specified margin is considered while importing the pages from the existing document.

public bool ExtendMargin { get; set; }

Property Value

bool

Examples

// Destination PDF document
PdfDocument destDoc = new PdfDocument();
PdfMargins margin = new PdfMargins();
//Set left margin.
margin.Left = 20;
//Set right margin.
margin.Right = 40;
//Set top margin.
margin.Top = 100;
//Set bottom margin.
margin.Bottom = 100;
//Set margin.
destDoc.PageSettings.Margins = margin;
// Source PDF documents
string[] source = { "Src1.pdf", "Src2.pdf" };
PdfMergeOptions option = new PdfMergeOptions();
option.ExtendMargin = true;  
//Merge the source pdf document.
PdfDocumentBase.Merge(destDoc, option, source);
destDoc.Save("Merge.pdf");
' Destination PDF document
Dim destDoc As PdfDocument = New PdfDocument()
Dim margin As New PdfMargins()
'Set left margin.
margin.Left = 20
'Set right margin.
margin.Right = 40
'Set top margin.
margin.Top = 100
'Set bottom margin.
margin.Bottom = 100
'Set margin.
destDoc.PageSettings.Margins = margin
' Source PDF documents
Dim source() As String = { "Src1.pdf", "Src2.pdf" }
'Merge the source pdf document.
Dim [option] As PdfMergeOptions = New PdfMergeOptions()
[option].ExtendMargin = True
PdfDocumentBase.Merge(destDoc, [option], source)
destDoc.Save("Merge.pdf")
See Also

MergeAccessibilityTags

Gets or sets a value indicating whether accessibility tags should be merged when combining PDF documents.

public bool MergeAccessibilityTags { get; set; }

Property Value

bool

Examples

 //Create a new PDF document.
PdfDocument finalDoc = new PdfDocument();
 //Creates a string array of source files to be merged.
 string[] source = { "file1.pdf", "file2.pdf" };
  PdfMergeOptions mergeOptions = new PdfMergeOptions();
 //Enable MergeAccessibilityTags.
 mergeOptions.MergeAccessibilityTags = true;
 //Merges PDFDocument.
 PdfDocument.Merge(finalDoc, mergeOptions, source);
 //Save the final document.
 finalDoc.Save("Sample.pdf");
 //Close the document.
 finalDoc.Close(true);
'Create a new PDF document.
Dim finalDoc As PdfDocument = New PdfDocument()
'Creates a string array of source files to be merged.
 Dim source As String() = {"file1.pdf", "file2.pdf"}
  Dim mergeOptions As PdfMergeOptions = New PdfMergeOptions()
'Enable MergeAccessibilityTags.
 mergeOptions.MergeAccessibilityTags = True
'Merges PDFDocument.
PdfDocument.Merge(finalDoc, mergeOptions, source)
 'Save the final document.
 finalDoc.Save("Sample.pdf")
 'Close the document.
 finalDoc.Close(True)
See Also

OptimizeResources

Gets or sets to optimize resources while merging PDF documents.

public bool OptimizeResources { get; set; }

Property Value

bool

Examples

// Destination PDF document
PdfDocument destDoc = new PdfDocument();
// Source PDF documents
string[] source = { "Src1.pdf", "Src2.pdf" };
PdfMergeOptions option = new PdfMergeOptions();
option.OptimizeResources = true;
//Merge the source pdf document.
PdfDocumentBase.Merge(destDoc, option, source);
destDoc.Save("Merge.pdf");
' Destination PDF document
Dim destDoc As PdfDocument = New PdfDocument()
' Source PDF documents
Dim source() As String = { "Src1.pdf", "Src2.pdf" }
'Merge the source pdf document.
Dim [option] As PdfMergeOptions = New PdfMergeOptions()
[option].OptimizeResources = True
PdfDocumentBase.Merge(destDoc, [option], source)
destDoc.Save("Merge.pdf")
See Also

See Also