Merge XPS files | Aspose.Page for Java

You can check the quality of Aspose.Page XPS Merger and view the results via free online XPS Merger

Aspose.Page Java XPS merger allows to merge XPS files to XPS document on any OS for which Java Virtual Machine exists.
It is necessary to do several steps in order to perform XPS merge:

  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 XPS files with created document and save it.


The following code snippet shows how to merge XPS files into one XPS document in Java:

 1// Merge several XPS files to one XPS document.
 2
 3// Load XPS document from XPS file
 4XpsDocument document = new XpsDocument(getDataDir() + "input.xps");
 5
 6// Create an array of XPS files that will be merged with the first one
 7String[] filesToMerge = new String[] { getDataDir() + "Demo.xps", getDataDir() + "sample.xps" };
 8
 9// Merge XPS files to output XPS document
10document.merge(filesToMerge, getOutputDir() + "mergedXPSfiles.xps");

See XPS merge in .NET and C++.

Aspose.Page Java XPS merger allows also to merge XPS files to PDF document.
It is necessary to do several steps in order to perform XPS to PDF merge:

  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. Specify TextCompressionImageCompressionJpegQualityLevel, and other options of PdfSaveOptions.
  4. Merge XPS files with created document and save it as PDF with PDF save options.


The following code snippet shows how to merge XPS files to PDF document in Java:

 1// Merge several XPS files to one PDF document.
 2
 3// Load XPS document from the XPS file
 4XpsDocument document = new XpsDocument(getDataDir() + "input.xps");
 5
 6// Initialize options object with necessary parameters.
 7PdfSaveOptions options = new PdfSaveOptions();
 8options.setJpegQualityLevel(100);
 9options.setImageCompression(PdfImageCompression.Jpeg);
10options.setTextCompression(PdfTextCompression.Flate);
11
12// Create an array of XPS files that will be merged with the first one
13String[] filesToMerge = new String[] { getDataDir() + "Demo.xps", getDataDir() + "sample.xps" };
14
15// Merge XPS files to output PDF file
16document.mergeToPdf(getOutputDir() + "mergedXPSfiles.pdf", filesToMerge, options);

See XPS merge in .NET and C++.

Let’s consider PdfSaveOptions. Using this class we can assign different conversion parameters while merging XPS to PDF.

Evaluate XPS merging online on our XPS Meger.

You can download examples and data files from GitHub.

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.