EPUB files are commonly used for large-scale printing purposes. In certain scenarios, you may need to preview the contents of an EPUB file in the form of an image. In accordance with such use cases, this article explains how to convert an EPUB file to a PNG or JPG programmatically in C#.
- EPUB to PNG or JPG Image Converter – C# API Installation
- Convert EPUB to PNG Image Programmatically in C#
- Convert EPUB to JPG Image in C#
EPUB to PNG or JPG Image Converter – C# API Installation
Aspose.HTML for .NET API can be used to work with HTML, XPS, EPUB, and many other supported file formats. Simply configure the API by downloading its DLL files from the New Releases page or using the following NuGet installation command in Visual Studio:
PM> Install-Package Aspose.Html
Convert EPUB to PNG Image Programmatically in C#
You can convert an EPUB file to a PNG format image with the following steps:
- Initialize an instance of the ImageSaveOptions class.
- Specify the image format and the size.
- Save the output image with the ConvertEPUB method.
The code sample below elaborates on how to convert an EPUB file to a PNG format image programmatically in C#:
Convert EPUB to JPG Image in C#
You need to follow the following steps in order to convert an EPUB file to a JPG image:
- Set the image format and dimensions with the ImageSaveOptions class object
- Convert the EPUB file to a JPG image by using the ConvertEPUB method.
The following code sample shows how to convert an EPUB file to the JPG format programmatically in C#:
Explore Aspose.HTML for .NET API
You may visit the API documentation to explore many other features offered by the API.
Get Free License
You may consider requesting a free temporary license to evaluate the API in its full capacity.
In this article, you have learned how to convert an EPUB file to different image formats like PNG, JPG, etc. It includes the C# code samples to demonstrate the EPUB conversion features. However, if you need to discuss your requirements or queries, please write to us at the forum.