Convert XPS to TIFF in Java

An XPS file contains XML based structure, content, layout, and appearance of a document. A single XPS file can have a single page or multiple pages. On the other hand, TIFF or TIF (Tagged Image File Format) is a standard file format representing raster images intended for use on various devices supporting it. In this article, we will learn how to convert XPS to TIFF in Java.

The following topics shall be covered in this article:

  1. Java XPS to TIFF Converter API – Free Download
  2. Steps to Convert XPS to TIFF
  3. Convert XPS to TIFF Image

Java XPS to TIFF Converter API – Free Download

For converting XPS to TIFF, we will be using the Aspose.Page for Java API. It enables us to load, merge, convert, and render XPS, PS, and EPS documents in Java applications.

The API provides the XpsDocument class that represents XPS documents. It provides the save(Device, SaveOptions) method for saving the XPS document using the Device instance. The ImageDevice class encapsulates the rendering of the document to the image. The TiffSaveOptions class of the API contains the options necessary for managing the TIFF-saving process.

Please either download the JAR of the API or add the following pom.xml configuration in a Maven-based Java application.

<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>22.9</version>
</dependency>

How to Convert XPS to TIFF

We can easily convert an XPS file to TIFF format by following the steps given below:

  • Load an XPS file.
  • Specify TIFF save options.
  • Save XPS as a TIFF.

The following section describes how to transform these steps into Java code and convert an XPS file to TIFF format.

Convert XPS to TIFF Image using Java

We can convert XPS files to TIFF images by following the steps given below:

  1. Firstly, load an XPS document using the XpsDocument class.
  2. Next, initialize the TiffSaveOptions class object.
  3. Then, specify save options such as SmoothingMode, Resolution, PageNumbers, etc.
  4. Meanwhile, create an instance of the ImageDevice class.
  5. After that, call the save() method to save the image in the ImageDevice object.
  6. Finally, use the ImageDevice to save the image as a TIFF file.

The following code example shows how to convert an XPS file to TIFF images using Java.

Free API License

You can get a free temporary license to try the library without evaluation limitations.

Try Online

Please try the following free online XPS to TIFF conversion tool, which is developed using the above API. It is a great tool for those who need to convert their XPS files to TIFF format.

https://products.aspose.app/page/conversion/xps-to-tiff

Conclusion

In this article, we have learned how to convert XPS to TIFF in Java. We have also seen how to specify various TIFF save options programmatically. Besides, you can learn more about Aspose.Page for Java API using documentation. In case of any ambiguity, please feel free to contact us on our free support forum.

See Also