Convert XPS with Aspose.Page JavaScript via C++ API

This article explains how to convert XPS files using JavaScript on the example of XPS to PDF Conversion.

Aspose.Page lets you convert XPS files using JavaScript in high-quality BMP, JPG, TIFF, PNG, and PDF documents.

You can check the quality of Aspose.Page XPS to PDF conversion and view the results via free online XPS to PDF Converter

Aspose.Page JavaScript via C++ XPS to PDF converter allows conversion of XPS documents to PDF on Windows and Linux.

It is necessary to take several steps to convert XPS to PDF:

  1. Create file reader ‘const file_reader = new FileReader();’ and read file ‘file_reader.readAsArrayBuffer(e.target.files[0]);’.
  2. On load event handler call AsposeXPSSaveAsPdf and pass the file content and its name, and SuppressError boolean values to it.
  3. The result JSON contains the file name in fileNameResult.
  4. If the SuppressErrors value was true, as it is by default, it is possible to see what errors were thrown during the conversion of XPS to PDF.
  5. You can download files by using the DownloadFile function: ‘DownloadFile(JSON.fileNameResult, “image/pdf”);’

The following code snippet shows how to convert XPS to PDF document in JavaScript:

                
            

For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-JavaScript-C

See XPS to PDF conversion in .Net and Java.

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

For converting XPS to an image format, there are the following parameters:

Check XPS conversion online on our XPS cross-platform Converter. You can convert several XPS files to PDF at once and download the results in a few seconds.

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.