Skip to content

PDFMerger

Namespace: O2S.Components.PDF4NET.Utilities

Utility class for fast merging of PDF files.

public class PDFMerger

Inheritance ObjectPDFMerger

Constructors

PDFMerger()

Initializes a new PDFMerger object.

public PDFMerger()

Properties

DocumentInformation

Gets or sets the document information.

public PDFDocumentInformation DocumentInformation { get; set; }

Property Value

PDFDocumentInformation
The document's metadata.


Methods

AppendFile(String, String)

Appends the given file to the merged file.

public void AppendFile(string fileName, string password)

Parameters

fileName String
PDF file to append.

password String
Password if the input file is encrypted.


AppendFile(Stream, String)

Appends the given file to the merged file.

public void AppendFile(Stream input, string password)

Parameters

input Stream
PDF file to append.

password String
Password if the input file is encrypted.


AppendFile(PDFFileEx)

Appends the given file to the merged file.

public void AppendFile(PDFFileEx pdfFile)

Parameters

pdfFile PDFFileEx
PDF file to append.

Remarks

After calling this method the 'pdfFile' object is no longer valid


MergeFiles(String, String[])

Merges multiple PDF files into a single one.

public static void MergeFiles(string outputFile, String[] inputFiles)

Parameters

outputFile String
Path to file where to save the merged file.

inputFiles String[]
Array of files names representing the PDF files to merge.


MergeFiles(Stream, Stream[])

Merges multiple PDF streams into a single one.

public static void MergeFiles(Stream output, Stream[] input)

Parameters

output Stream
Stream where to save the merged file.

input Stream[]
Array of steams that contain the PDF files to merge.


Save(String, PDFSecurityHandler, Boolean)

Saves the merged file to given file.

public void Save(string fileName, PDFSecurityHandler securityHandler, bool enableObjectCompression)

Parameters

fileName String
Path to file where to save the merged file.

securityHandler PDFSecurityHandler
Security handler for encrypting the merged file.

enableObjectCompression Boolean
True if the merged file should compress the PDF file structure.


Save(Stream, PDFSecurityHandler, Boolean)

Saves the merged file to given stream.

public void Save(Stream output, PDFSecurityHandler securityHandler, bool enableObjectCompression)

Parameters

output Stream
Stream where the merged file will be saved.

securityHandler PDFSecurityHandler
Security handler for encrypting the merged file.

enableObjectCompression Boolean
True if the merged file should compress the PDF file structure.