How to Convert PUB to JPG in Java

This quick tutorial guides you on how to convert PUB to JPG in Java. It explains all the basic details like environment setup, and the step-wise process followed by sample code demonstrating the feature to convert Publisher to JPG in Java. You do not need to install Microsoft Publisher or any other application to process the PUB files and export them as JPG images.

Steps to Convert PUB to JPG using Java

  1. Configure Aspose.PUB and Aspose.PDF libraries to render PUB files
  2. Load the input PUB file with the IPubParser interface
  3. Export the loaded PUB file as a PDF document
  4. Access the intermediate PDF document
  5. Get the size for each page of the PDF file
  6. Set the page size and image resolution for JPG images
  7. Convert each page to JPG image format using the process() method

The above steps sum up the whole process to build a Publisher to JPG converter in Java. These explain the libraries’ integration into your projects followed by the algorithm and the sample code. You only need to make a couple of API calls to load the input PUB file, convert it to PDF format and then render the output JPG images.

Code to Convert PUB to JPG in Java

This code snippet illustrates how to convert Microsoft Publisher to JPG in Java. First of all, it parses the input PUB file using the parse() method. Subsequently, it exports the parsed file as a PDF document and then renders the JPG images of each page using the JpegDevice class instance.

This tutorial has discussed the information related to the conversion of a PUB file to JPG in Java. On the other hand, if you want to convert the PUB file to a PNG image, please read the article on how to convert PUB to PNG in Java.

 English