How to Convert XPS File to PDF in C#

This quick tutorial explains how to convert XPS file to PDF in C#. It elaborates on environment configuration, and stepwise algorithm, followed by a runnable code snippet to convert XPS to PDF in C#. Moreover, it also covers custom properties to improvise the conversion process to meet your requirements.

Steps to Convert XPS File to PDF File in C#

  1. Configure the environment by installing Aspose.PDF for .NET to convert XPS to PDF
  2. Create an instance of XpsLoadOptions class
  3. Load the input XPS file with the Document class
  4. Call the Save method to render XPS to PDF format

The steps above present a complete picture of the process to export XPS document to PDF in C#. First of all, it explains the system configuration for integrating this feature into your application. Next, it covers the conversion process where the source XPS file is loaded and then rendered to PDF format.

Code to Convert XPS to PDF in C#

This code snippet shows how to convert XPS file to PDF in C#. You only need to make a couple of API calls to load the source XPS file and convert it to PDF format. Moreover, the XpsLoadOptions class exposes different properties to improvise the process like setting the batch size for converting a batch of files, load format, or warning handlers during the conversion process.

This tutorial has explained how to create XPS to PDF converter in C#. However, if you want to learn the inverse conversion of PDF to XPS format then refer to the article on how to convert PDF to XPS in C#.

 English