Merger Class

Wordize.Merging.Merger class. Represents a group of methods intended to merge a variety of different types of documents into a single output document.

Merger class

Represents a group of methods intended to merge a variety of different types of documents into a single output document.

public class Merger : Processor

Methods

NameDescription
static Create()Creates Merger processor.
static Create(MergerContext)Creates Merger processor with specified Merger context.
Execute()Execute the processor action.
From(Stream, LoadOptions)Specifies input document for processing.
From(string, LoadOptions)Specifies input document for processing.
To(List<Stream>, SaveFormat)Specifies output Document streams list.
To(List<Stream>, SaveOptions)Specifies output Document streams list.
To(Stream, SaveFormat)Specifies output stream for the processor.
To(Stream, SaveOptions)Specifies output stream for the processor.
To(string, SaveFormat)Specifies output file for the processor.
To(string, SaveOptions)Specifies output file for the processor.
static Merge(string, string[])Merges the given input documents into a single output document using specified input and output file names.
static Merge(Stream, Stream[], SaveFormat)Merges the given input documents into a single output document using specified input output streams and the final document format.
static Merge(Stream, Stream[], SaveFormatMergeFormatMode)Merges the given input documents into a single output document using specified input output streams and the final document format.
static Merge(string, string[], SaveFormatMergeFormatMode)Merges the given input documents into a single output document using specified input output file names and the final document format.
static MergeToImages(Stream[], ImageSaveOptionsMergeFormatMode)Merges the given input document streams into a single output document using specified image save options. Renders the output to images.
static MergeToImages(string[], ImageSaveOptionsMergeFormatMode)Merges the given input documents into a single output document using specified input output file names and save options. Renders the output to images.

Remarks

The specified input and output files or streams, along with the desired merge and save options, are used to merge the given input documents into a single output document.

The merging functionality supports over 35 different file formats.

Examples

Shows how to merge several PDF document into one document keeping original document layout.

string outputFileName = ArtifactsDir + "Merger.Merge.pdf";
string[] inputFiles = new string[] { MyDir + "Merger.pdf", MyDir + "Merger1.pdf", MyDir + "Merger2.pdf" };

Merger.Merge(outputFileName, inputFiles);

Shows how to merge several PDF documents and save the result to image streams.

string[] inputFiles = new string[] { MyDir + "Merger.pdf", MyDir + "Merger1.pdf", MyDir + "Merger2.pdf" };

Stream[] pages = Merger.MergeToImages(inputFiles, new ImageSaveOptions(SaveFormat.Png), MergeFormatMode.KeepSourceLayout);

Shows how to merge several documents using fluent API and save the result as a single image.

ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.Png);
imageSaveOptions.PageLayout = MultiPageLayout.Grid(2, 10, 10);
imageSaveOptions.PaperColor = Color.White;
imageSaveOptions.PageLayout.BackColor = Color.Gray;
imageSaveOptions.PageLayout.BorderColor = Color.Black;
imageSaveOptions.PageLayout.BorderWidth = 2;

Merger.Create()
    .From(MyDir + "Merger.docx")
    .From(MyDir + "Merger.doc")
    .From(MyDir + "Merger.rtf")
    .To(ArtifactsDir + "Merger.Grid.png", imageSaveOptions)
    .Execute();

See Also