EPUB Converter – Convert EPUB in Java

Use the EPUB Converter guides to convert an EPUB e-book to PDF, XPS, DOCX, JPG, PNG, BMP, TIFF, and GIF in Java. Open the EPUB as a stream, create save options for the target format, and call Converter.convertEPUB().

EPUB is an open e-book standard that packages HTML, CSS, images, and other publication resources into one file. Aspose.HTML for Java provides convertEPUB() overloads for converting EPUB content to fixed-layout documents and raster images.

How EPUB Conversion Works

  1. Open the source EPUB file as an input stream.
  2. Create save options for the required output format, such as PdfSaveOptions or ImageSaveOptions.
  3. Call Converter.convertEPUB(stream, options, outputPath) to convert the EPUB content.

The following Java example opens input.epub, creates PdfSaveOptions, and converts the e-book to output-epub-to-pdf.pdf.

 1// Convert EPUB to PDF in Java
 2
 3// Open an existing EPUB file for reading
 4java.io.FileInputStream fileInputStream = new java.io.FileInputStream("input.epub");
 5
 6// Create an instance of the PdfSaveOptions class
 7PdfSaveOptions options = new PdfSaveOptions();
 8
 9// Call the convertEPUB() method to convert EPUB to PDF
10Converter.convertEPUB(fileInputStream, options, "output-epub-to-pdf.pdf");

EPUB Conversion Guides

The Java API also provides convertEPUB() overloads that accept XpsSaveOptions, DocSaveOptions, other ImageFormat values, and output stream providers. The articles above document the EPUB output formats currently covered by Java examples in this section.

Related Conversion Topics

Other Platforms

Try Online EPUB Conversion

Use the free online EPUB Converter for quick manual conversion without writing Java code. Use Aspose.HTML for Java when EPUB conversion must run programmatically.

Download complete Java examples and data files from GitHub.