EPUB Converter – С# – Aspose.HTML for .NET
Convert EPUB Using C#
EPUB is an e-book file format that provides a standard digital publication format for publishers and consumers. The format has been so common by now that many e-readers and software applications support it. For example, on Mac OS, the pre-installed Books software provides the support for opening such files. In addition, a variety of compatible software is available for smartphones, tablets and computers. EPUB file standards are maintained by the International Digital Publishing Forum (IDPF).
The main highlight of Aspose.HTML for .NET is the conversion feature. EPUB is an open XML-based format for digital books and publications that can be viewed and read on a variety of devices. EPUB conversions are often required to take advantage of other formats. The Aspose.Html.Converters namespace implements easy access to conversion methods. It provides a wide range of EPUB conversions to popular formats, such as PDF, XPS, DOCX, JPG, PNG, BMP, TIFF, and GIF.
This section provides information on the list of supported EPUB conversions and how to perform them using Converter.ConvertEPUB() methods. It can be different scenarios, but any EPUB conversion can be made with a few required steps:
- Load an existing EPUB file.
- Create a Save Options object. You may customize the rendering process to get the desired result.
- Use one of the ConvertEPUB() methods and pass the required parameters to it.
Let’s consider the following code snippet that shows how to convert EPUB to PDF:
1// Open an existing EPUB file for reading
2using var stream = File.OpenRead(DataDir + "input.epub");
3
4// Prepare a path to save the converted file
5string savePath = Path.Combine(OutputDir, "input-output.pdf");
6
7// Create an instance of the PdfSaveOptions class
8var options = new PdfSaveOptions();
9
10// Call the ConvertEPUB() method to convert EPUB to PDF
11Converter.ConvertEPUB(stream, options, savePath);
In the example, we specify the source path to EPUB file for the ConvertEPUB() method. The PdfSaveOptions() constructor creates an instance of PdfSaveOptions with default options. The ConvertEPUB() method of the Converter class takes the EPUB file source path, PdfSaveOptions, and output file path and performs EPUB to PDF conversion.
Note: You need to specify the path to the source and output file in your local file system (sourcePath
and outputPath
).
Online EPUB Converter
You can check the Aspose.HTML for .NET API functionality and convert EPUB in real-time. Please load an EPUB file from the local file system, select the output format and run the example. In the example, the save options are set by default. You will immediately receive the result as a separate file.
You can download the complete examples and data files from GitHub.
Aspose.HTML offers a free online EPUB Converter for converting EPUB files to a variety of popular formats. You can easily convert EPUB to PDF, EPUB to XPS, EPUB to DOCX, EPUB to JPG, EPUB to PNG, EPUB to BMP, EPUB to TIFF, or EPUB to GIF. Just select the file, choose the format to convert, and you’re done. It’s fast and completely free!