EPUB Converter | 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 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, JPEG, 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:

  1. Load an existing EPUB file.
  2. Create a Save Options object. You may customize the rendering process to get the desired result.
  3. 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:

using System.IO;
using Aspose.Html.Converters;
using Aspose.Html.Saving;
...        

    // Prepare a path to a source EPUB file
    string sourcePath = Path.Combine(DataDir, "input.epub");           
    
    // Prepare a path to save the converted file 
    string outputPath = Path.Combine(OutputDir, "input-output.pdf");
    
    // Create an instance of PdfSaveOptions
    var options = new PdfSaveOptions();
    
    // Call the ConvertEPUB method to convert EPUB to PDF
    Converter.ConvertEPUB(sourcePath, options, outputPath);

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 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.

Code example in C# to convert document formats
Input file
Upload a file you want to convert
Output format
Select the target format