EPUB Converter | C#

Contents
[ Hide Show ]

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, 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:

  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:

 1using System.IO;
 2using Aspose.Html.Converters;
 3using Aspose.Html.Saving;
 4...        
 5
 6    // Prepare a path to a source EPUB file
 7    string sourcePath = Path.Combine(DataDir, "input.epub");
 8    
 9    // Prepare a path to save the converted file 
10    string outputPath = Path.Combine(OutputDir, "input-output.pdf");
11    
12    // Create an instance of PdfSaveOptions
13    var options = new PdfSaveOptions();
14    
15    // Call the ConvertEPUB() method to convert EPUB to PDF
16    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).

You can download the complete examples and data files from GitHub.

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.

                
            

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!

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.