Merge XPS documents to PDF

C++ API solution to combine several XPS files

 

The XPS file format allows the storage of multiple documents within a single file and is also able to contain multiple pages. Aspose.Page API Solution for C++ offers the ability to merge multiple files into one, resulting in an XPS or PDF file that contains the combined content of all the original files.

Here you will find a code example of how to use the API for merging XPS files. To explore how this functionality can be integrated into a web solution or used for online file merging, you can try out the cross-platform XPS Merger tool.

To merge PS and EPS files, you need:

  • Aspose.Page for C++ API which is a feature-rich, powerful and easy to use document manipulation and conversion API for C++ platform.

  • You can download its latest version directly, just open NuGet package manager, and search for Aspose.Page.Cpp and install. You may also use the following command from the Package Manager Console.

Package Manager Console Command


    PM> Install-Package Aspose.Page.Cpp

Steps to merge several XPS files to PDF with C++.

  1. Set the path to the documents directory.
  2. Initialize the PDF output and XPS file input streams.
  3. Create an instance of XpsDocument from created earlier input stream.
  4. Initialize options object with the TextCompression, ImageCompression, JpegQualityLevel parameters for the output file by means of the PdfSaveOptions Class.
  5. Using the PdfDevice Class, create a rendering device for PDF format.
  6. Merge XPS files to output XPS document.
Used namespaces
using Aspose::Page::XPS;
using Aspose::Page::IO;
using Aspose::Page::Presentation::Pdf;
Merge PS files to PDF

Steps to merge several XPS files into a single file with C++.

  1. Create an instance of XpsDocument from the first XPS file.
  2. Create an array of XPS files that will be merged with the first one.
  3. Merge (by Merge ) XPS files with created document and save it.
Merge PS files to PDF

XPS What is XPS File Format

XPS format is similar to PDF format. Both are page description language (PDL) formats. EPS is based on HTML and not on PostScript language. The .eps file is capable to contain a markup of the document's structure along with the information on how the document would look like. There are also added instructions on how to print and render the document. The feature of the format is that it fixes the document's description which means that it will look the same no matter who and from what operational system opens it.