Convert XPS to BMP in Python - XPS to Image

Introduction

XPS to Image - API Installation

  • This section walks through the installation process of this Python library.

Convert XPS to BMP in Python - Code Sample

  • Here we will implement the functionality to build an XPS file converter by writing a code snippet.

XPS File Converter - Online Tool

  • In this last part, we will touch on an online tool used for XPS to BMP conversion.

This is another exciting blog post in the category of Aspose.Page and we will learn about another rich conversion between two file formats. So, this guide will mainly focus on programmatic XPS to BMP conversion using an enterprise-level API for Python developers. In addition, we will also dive into the API references and make method invocations offered by Aspose.Page for Python via .NET. Therefore, please stick to this article to the end and replicate it for your business software. Let’s get started.

XPS to Image - API Installation

One of the reasons this Python library stands out is that it offers robust hassle-free installation. So, go ahead and download the latest version, or you may run the following pip command into the terminal/CMD:

pip install aspose-page 

Convert XPS to BMP in Python - Code Sample

Now, here comes the implementation section where we will demonstrate how to develop an XPS to BMP converter by writing a few lines of source code in Python. However, you need to have a source XPS file to test the feature.

You can follow the following steps and the code sample to convert XPS to BMP in Python programmatically:

  • Load the XPS document from the stream by initializing the XpsDocument class.
  • Initialize an object of the BmpSaveOptions class.
  • Set the value of the smoothing_mode property.
  • Set the values of resolution and page_numbers properties.
  • Create an instance of the ImageDevice class.
  • Invoke the save method to save the file.
  • Iterate through document partitions (fixed documents, in XPS terms) and save the file as a BMP image on the disk.

You can see the output in the image:

XPS to Image

XPS File Converter - Online Tool

We have covered the programmatic way to achieve XPS to image conversion. Next, we will walk through an online tool powered by Aspose.Page. It is free and you can leverage its seamless conversion and manipulation features. Above all, you can upload source files by opting for multiple options.

XPS File Converter

Get a Free License

You can get a free temporary license to try this Python API beyond evaluation limitations.

Summing up

We are ending this guide here and we hope you found this article worth reading. It covered steps and demonstrated the XPS to BMP conversion with code example. Moreover, you can visit the documentationAPI references, and the GitHub repo for further exploration. In addition, Aspose.Page provides solutions for multiple programming languages which you can find here. Thanks for your time and we will come again with another guide. So, stay tuned at aspose.com.

Feel Free to Reach Out

You can let us know about your questions or queries on our forum.

See Also