Convert EPUB to PDF using C#

[ ]

Aspose.PDF for .NET allows you simply convert EPUB files to PDF format.

EPUB (short for electronic publication) is a free and open e-book standard from the International Digital Publishing Forum (IDPF). Files have the extension .epub. EPUB is designed for reflowable content, meaning that an EPUB reader can optimize text for a particular display device.

EPUB also supports fixed-layout content. The format is intended as a single format that publishers and conversion houses can use in-house, as well as for distribution and sale. It supersedes the Open eBook standard.The version EPUB 3 is also endorsed by the Book Industry Study Group (BISG), a leading book trade association for standardized best practices, research, information and events, for packaging of content.

Live Example

Aspose.PDF for .NET presents you online free application “EPUB to PDF”, where you may try to investigate the functionality and quality it works.

Epub to PDF

Conversion steps:

  1. Create an instance of EpubLoadOptions class.
  2. Create an instance of Document class with mention source filename and options.
  3. Save the document with the desired file name.

Next following code snippet show you how to convert EPUB files to PDF format with C#.

public static void ConvertEPUBtoPDF()
    EpubLoadOptions option = new EpubLoadOptions();
    Document pdfDocument= new Document(_dataDir + "WebAssembly.epub", option);
    pdfDocument.Save(_dataDir + "epub_test.pdf");

You can also set page size for conversion. To define new page size you SizeF object and pass it to EpubLoadOptions constructor.

public static void ConvertEPUBtoPDFAdv()
    EpubLoadOptions option = new EpubLoadOptions(new SizeF(1190, 1684));
    Document pdfDocument= new Document(_dataDir + "WebAssembly.epub", option);
    pdfDocument.Save(_dataDir + "epub_test.pdf");