This basic article contains details about how to convert PDF to XPS in C#. It includes all the information for configuring the .NET environment and the step-by-step guide to achieve the requirements. In order to convert PDF to XPS C# code is provided that can be modified to set respective properties as per your needs.
Steps to Convert PDF to XPS in C#
- Configure your application by installing Aspose.PDF dependency with the NuGet package manager
- Load the source PDF with the Document class for converting it to XPS format
- Create an XpsSaveOptions class object and set different properties
- Save the output file in XPS file format
In order to create a PDF to XPS converter C# code is exhibited here that demonstrates the complete process. Quickly load an input PDF document from a MemoryStream or from the disk, then specify different characteristics for generating the XPS file. Finally, write the rendered output file to a MemoryStream, Byte Array, or to the disk, based on your application design.
Code to Convert PDF to XPS in C#
This code snippet demonstrates how using C# convert PDF to XPS document without needing to install any other tool. Moreover, you can choose to preserve transparent text in the output file. Likewise, the code snippet can be improvised to convert all the pages or only some selected pages to the XPS file format.
This article has covered how using C# PDF to XPS rendering can be performed while explaining several customization properties. However, if you are interested to learn PDF to PDFA conversion, please refer to the article on how to convert PDF to PDFA format using C#.