How to Convert PUB to JPG in C#

This basic tutorial covers how to convert PUB to JPG in C#. It includes the environment configuration as well as the algorithm and code snippet to clarify the complete process to export Publisher to JPG in C#. You only need to make a couple of API calls to process the PUB files and render them as JPG images.

Steps to Convert PUB to JPG using C#

  1. Install Aspose.PUB and Aspose.PDF libraries to process PUB files
  2. Parse the input PUB file with the Parse method
  3. Convert the PUB file to an intermediate PDF file
  4. Load the PDF file to process each page
  5. Iterate each page of the PDF document
  6. Set the resolution for the output images
  7. Render each page as a JPG image using JpegDevice.Process method

These steps summarize the complete process to create a Publisher to JPG converter in C#. It covers the environment setup details and all the basic information that you need to know for performing the conversion. In a nutshell, it converts the PUB file to a PDF document and then each page of the document is exported as a JPG image.

Code to Convert PUB to JPG in C#

The code snippet above is a quick demonstration of how to convert Microsoft Publisher to JPG in C#. The ConvertToPdf method renders the PUB file into a PDF document in a stream. Then the PDF file is processed page by page where different constructors are available for JpegDevice class that can be used to specify page resolution, dimension, etc. based on your requirements. Finally, the output JPG image files are exported with the Process method.

This tutorial has explained the details pertaining to the conversion of a PUB file to JPG in C#. However, if you want to convert the PUB file to a PNG image, please refer to the article on how to convert PUB to PNG in C#.

 English