Merge XPS

How to merge XPS files in C#

GroupDocs.Merger allows developers to merge XPS files when it’s needed to organize multiple XPS files into single document or send fewer attachments etc. And you can do this without¬†any third-party software or manual work involved. With GroupDocs.Merger it is possible to combine XPS documents of any size and structure - all text, images, tables, graphs, forms and other content will be preserved.

The following example demonstrates how to merge XPS files with several lines of C# code:

  • Create an instance of Merger class and pass source XPS file path as a constructor parameter. You may specify absolute or relative file path as per your requirements.
  • Add another XPS file to merge with Join method. Repeat this step for other XPS documents you want to merge.
  • Call Merger class Save method and specify the filename for the merged XPS file as parameter.
// Load the source XPS file
using (Merger merger = new Merger(@"c:\sample1.xps"))
{
    // Add another XPS file to merge
    merger.Join(@"c:\sample2.xps");
    // Merge XPS files ans save result
    merger.Save(@"c:\merged.xps");
}

About XPS File Format

An XPS file represents page layout files that are based on XML Paper Specifications created by Microsoft. This format was developed by Microsoft as replacement of EMF file format and is similar to PDF file format, but uses XML in layout, appearance, and printing information of a document. It is, in fact, more justified to say that XPS is an attempt on PDF, but couldn’t get enough popularity as owned by PDF for a number of reasons.

Code Examples

Please find more use-cases and complete C# sources of our backend and frontend examples and try them for free!

Merge XPS Live Demo

GroupDocs.Merger for .NET provides an online XPS Merger App, which allows you to try it for free and check its quality and accuracy.

“Merge XPS”