Convert XPS to BMP, JPEG, PNG, and TIFF using Java

XPS (XML Paper Specifications) format was introduced by Microsoft that is used to represent page layout. It uses XML tags to represent the appearance of the pages and the composition of the document. In various scenarios, you may need to convert XPS documents to other document formats. In accordance with that, in this article, you will learn about the conversion of XPS documents to raster image formats programmatically. Particularly, the article will cover how to convert XPS to BMP, JPEG, PNG, and TIFF using Java.

XPS to Image Converter API – Free Download

Aspose.Page for Java is designed to work with PS, EPS, and XPS documents from within the Java applications. The API’s built-in converter lets you perform high-quality conversion of XPS to raster image formats including PNG, JPEG, BMP, and TIFF images. You can either download the API’s JAR or install it within your Maven-based applications.

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-page</artifactId>
    <version>20.11</version>
</dependency>

Convert XPS to Raster Images in Java

Aspose.Page for Java provides separate classes in order to customize the XPS to raster image conversion. For example, you can set the resolution of the output image, specify the pages you want to convert, and so on. The following is the list of the classes that you may use accordingly.

Convert XPS to PNG in Java

The following are the steps to convert the XPS documents to PNG images using Aspose.XPS for Java.

The following code sample shows how to convert XPS to PNG using Java.

Convert XPS to JPEG in Java

The following are the steps to convert XPS to JPEG using Aspose.Page for Java.

The following code sample shows how to convert XPS to JPEG.

Convert XPS to BMP in Java

You can convert the XPS files to BMP images in the same way you have done for PNG and JPEG. The following are the steps for it.

The following code sample shows how to convert an XPS file to BMP.

Convert XPS to TIFF in Java

The following are the steps to convert XPS document to TIFF image.

The following code sample shows how to convert XPS document to TIFF image in Java.

Conclusion

In this article, you have learned how to convert XPS files to raster image formats using Java. The step-by-step guide, API references, and code samples have shown how to convert XPS to PNG, JPEG, TIFF, and BMP images. You can explore other features of the Java XPS API using the documentation.

See Also