Do you want to convert documents from EPUB format to TIFF images? If so, you’ve come to the right place. In this article, we will learn how to convert EPUB to TIFF in C# by following a few simple steps.
The EPUB format is an open standard that allows authors to store digital information such as eBooks, magazines, and other digital content in a file format that can be played back and read easily. EPUB is a file format that can be read either with your computer or on a device like an eReader (e.g., Kindle etc.). In certain cases, we may need to export eBooks or other documents from EPUB to TIFF images.
The TIFF (Tagged Image File Format) file format is a popular raster image format for use and display on a wide variety of devices. We can easily export eBooks and other digital documents from EPUB to TIFF programmatically. So, keep reading for detailed steps on how to convert EPUB to TIFF in C#.
The following topics shall be covered in this article:
- C# EPUB to TIFF Converter API
- Steps to Convert EPUB to TIFF
- Convert EPUB to TIFF
- Customize EPUB to TIFF Conversion
C# EPUB to TIFF Converter API
For converting document from EPUB to TIFF, we will be using the Aspose.HTML for .NET API. The API allows the creation, modification, and extraction of HTML data. Furthermore, it allows you to convert HTML document formats, EPUB, Markdown, and SVG image formats into other supported formats without the need for external software.
The API provides the ImageSaveOptions class provides properties to manage image result resolution, smoothing quality, format, and page settings for the images. The Converter class of the API provides a wide range of conversions to the popular formats, such as PDF, XPS, image formats, etc. It provides the ConvertEPUB(Stream, ImageSaveOptions, string) method that converts the EPUB source presented by data input stream and saves in a file formed by output file path.
PM> Install-Package Aspose.Html
How to Convert EPUB to TIFF in C#
We can easily convert an EPUB document into a TIFF image by following the steps given below:
- Load an existing EPUB document.
- Specify image save options.
- Convert EPUB to TIFF.
The following section describes how to transform these steps into C# code and save an EPUB document as a TIFF image.
Convert EPUB to TIFF using C#
We can save an EPUB document as a TIFF image by following the steps given below:
- Firstly, open an existing EPUB file for reading using the File.OpenRead().
- Next, create an instance of the ImageSaveOptions class.
- After that, specify the Format as ImageFormat.Tiff.
- Finally, call the Converter.ConvertEPUB() method to save a TIFF. It takes EPUB file stream, ImageSaveOptions and output TIFF file path as arguments.
The following code sample shows how to convert an EPUB to a TIFF in C#.
Customize EPUB to TIFF Conversion in C#
We can also customize EPUB to TIFF conversion by following the steps mentioned earlier. However, we need to specify additional options such as Compression, SmoothingMode, HorizontalResolution, VerticalResolution, BackgroundColor, etc. in step # 4.
The following code sample shows how to customize the conversion of EPUB to TIFF in C#.
Get Free License
You can get a free temporary license to try Aspose.HTML for .NET without evaluation limitations.
In this article, we have learned how to convert an EPUB to a TIFF in C#. We have also seen how to specify additional save options to customize the conversion. Besides, you can learn more about Aspose.HTML for .NET API using documentation. In case of any ambiguity, please feel free to contact us on our free support forum.