Companion

Functions

Link copied to clipboard
fun open(source: KiteByteSource, settings: EpubSettings): EpubDocument

Open the book in source at settings, holding only the container's directory and the entries that layout reads, so a book larger than the heap opens. Each entry is read from source when a chapter, a style sheet, a font or an image needs it, so the caller keeps source open until it drops the document, and closes it after.

fun open(bytes: ByteArray, settings: EpubSettings): EpubDocument

Open bytes at settings. Reads the container, the OPF and the table of contents; chapters parse and lay out when something asks for them.

fun open(bytes: ByteArray, pageWidth: Double = 400.0, pageHeight: Double = 640.0, fontSize: Double = 12.0, margin: Double = 36.0): EpubDocument
Link copied to clipboard
fun EpubDocument.Companion.openFile(path: String, settings: EpubSettings = EpubSettings()): EpubDocument

Opens the EPUB at path, loading the WHOLE file into memory first (thin sugar over EpubDocument.open; there is no incremental file reader).

fun EpubDocument.Companion.openFile(path: String, settings: EpubSettings = EpubSettings()): EpubDocument

Opens the EPUB at path, loading the WHOLE file into memory first (thin sugar over EpubDocument.open; there is no incremental file reader).

fun EpubDocument.Companion.openFile(path: String, settings: EpubSettings = EpubSettings()): EpubDocument

Opens the EPUB at path, loading the WHOLE file into memory first (thin sugar over EpubDocument.open; there is no incremental file reader).

Link copied to clipboard
fun openOrNull(source: KiteByteSource, settings: EpubSettings = EpubSettings()): EpubDocument?

open from a KiteByteSource, but null instead of EpubFormatException on a malformed book.

fun openOrNull(bytes: ByteArray, settings: EpubSettings = EpubSettings()): EpubDocument?

open, but null instead of EpubFormatException on a malformed book.