Migration Notes

Why To Migrate?

Here are the key reasons to use the new updated API provided by GroupDocs.Merger for .NET since version 19.9:

  • Merger class introduced as a single entry point to manage the document processing of any supported file format (instead of DocumentHander class from previous versions). 
  • Product architecture was redesigned from scratch in order to decreased memory usage (from 10% to 400% approx. depending on document type).
  • Document processing API simplified and improved so it’s easy to instantiate proper options class and control over document structure manipulation processes.

How To Migrate?

Here is a brief comparison of how to join documents using old and new API.

Old coding style

string sourceFile1 = CommonUtilities.fileOne + fileOne;
string sourceFile2 = CommonUtilities.fileTwo + fileTwo;


// Preparing.
string password = "SomePasswordString";
Stream openFile1 = new FileStream(sourceFile1, FileMode.Open);
Stream openFile2 = new FileStream(sourceFile2, FileMode.Open);

List<JoinItem> documentStreams = new List<JoinItem>();

JoinItem item1 = new JoinItem(openFile1, FileFormat.Docx, password);
documentStreams.Add(item1);
JoinItem item2 = new JoinItem(openFile2, FileFormat.Docx, password);
documentStreams.Add(item2);


// Main method.
DocumentResult result = new DocumentHandler().Join(documentStreams);

Stream documentStream = result.Stream;
var fileStream = File.Create(CommonUtilities.outputPath + "OutPut." + FileFormat.Docx);
documentStream.CopyTo(fileStream);
documentStream.Close();

New coding style

using (Merger merger = new Merger(@"c:\sample1.docx"))
{
    merger.Join(@"c:\sample2.docx");
    merger.Save(@"c:\output\result.docx");
}

For more code examples and specific use cases please refer to our Developer Guide documentation or GitHub samples and showcases.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.