Convert PUB to Image Programmatically in Java

Convert PUB to JPG PNG TIFF Image Java

Microsoft Publisher Files are used for printing or publishing information. You can convert PUB to JPG, PNG, or TIFF images programmatically using Java. In this article, you will learn how to convert the PUB file to different image formats:

PUB to Image Conversion – Java APIs Installation

Aspose.PUB for Java API supports working with PUB files. You can render the PUB files to PDF and then utilize Aspose.PDF for Java API to convert the output PDF file to image formats like JPG, PNG, TIFF, etc. You can download the JAR files for Aspose.PUB for Java and Aspose.PDF for Java API or specify the following configurations to download the APIs from the Maven repository:


        <name>Aspose Java API</name>






Convert PUB to JPG Image Programmatically using Java

You can convert a Microsoft Publisher (PUB) file to JPG image with the following steps:

  1. Load input PUB file.
  2. Convert PUB to PDF file with convertToPdf method.
  3. Get page dimensions from the PDF document.
  4. Specify the Resolution and dimensions of the output image.
  5. Save output JPG image using JpegDevice.

The code below explains how to convert PUB to JPG image using Java:

Convert PUB to PNG Image Programmatically with Java

You can convert a PUB file to PNG format image with the steps below:

  1. Load input PUB file with createParser() method.
  2. Convert PUB to PDF file.
  3. Specify width and height of output image.
  4. Finally, convert PUB to PNG image.

The following code shows how to convert PUB to PNG image with Java:

PUB to TIFF Conversion Programmatically in Java

You can convert PUB file to a TIFF image with the steps listed below:

  1. Firstly, load the input Publisher (PUB) file.
  2. Convert PUB to PDF file using convertToPdf() method.
  3. Specify properties for TIFF image using TiffSettings class.
  4. Finally, convert PUB to TIFF image with TiffDevice instance.

The following code demonstrates how to convert PUB to TIFF image programmatically using Java:

Get Free API License

You can evaluate the API in its full capacity by requesting a Free Temporary License.


In conclusion, you have learned how to convert Microsoft Publisher, PUB, files to different image formats like JPG, PNG, TIFF, etc, programmatically using Java. Moreover, you can learn about more features by visiting the Documentation of Aspose.PUB for Java API. Furthermore, please feel free to contact us via the Free Support Forum for any of your concerns.

See Also

Recognize Text by Performing OCR on Image from URL with Java