The XML Paper Specification (XPS) format is an electronic representation of digital documents based on XML. It is a paginated, fixed-layout format that enables the content and design details of a document to be maintained intact across computers. Sometimes you may need to convert a PowerPoint document to XPS for better printing or sharing, and this article will demonstrate how to accomplish this task programmatically using Spire.Presentation for .NET.
Install Spire.Presentation for .NET
To begin with, you need to add the DLL files included in the Spire.Presentation for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Presentation
Convert PowerPoint to XPS
The detailed steps are as follows:
- Create a Presentation instance.
- Load a sample PowerPoint document using Presentation.LoadFromFile() method.
- Save the PowerPoint document to XPS using Presentation.SaveToFile(String, FileFormat) method.
- C#
- VB.NET
using Spire.Presentation; namespace PowerPointtoXPS { class Program { static void Main(string[] args) { //Create a Presentation instance Presentation presentation = new Presentation(); //Load a sample PowerPoint document presentation.LoadFromFile("test.pptx"); //Save to XPS file presentation.SaveToFile("toXPS.xps", FileFormat.XPS); } } }
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.