open

fun open(bytes: ByteArray, pageWidth: Double = 400.0, pageHeight: Double = 640.0, fontSize: Double = 12.0, margin: Double = 36.0): EpubDocument(source)


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

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

Throws

when the bytes are not a readable EPUB, with a message naming the first structural failure (missing container.xml, missing OPF, empty spine, no readable documents).


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.

Throws

when the source is not a readable EPUB.