PdfMergeOptions Class
Represents to customize the support of merging PDF documents.
Inheritance
System.Object
PdfMergeOptions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfMergeOptions
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()
Declaration
public PdfMergeOptions()
Properties
ExtendMargin
When ExtendMargin is set to true, then specified margin is considered while importing the pages from the existing document.
Declaration
public bool ExtendMargin { get; set; }
Property Value
Type |
---|
System.Boolean |
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")
MergeAccessibilityTags
Gets or sets a value indicating whether accessibility tags should be merged when combining PDF documents.
Declaration
public bool MergeAccessibilityTags { get; set; }
Property Value
Type |
---|
System.Boolean |
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)
OptimizeResources
Gets or sets to optimize resources while merging PDF documents.
Declaration
public bool OptimizeResources { get; set; }
Property Value
Type |
---|
System.Boolean |
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")