Package-level declarations

Types

Link copied to clipboard

A parsed EPUB, reflowed onto fixed-size pages and rendered through the shared KiteCanvas the PDF engine uses. The second document handler on :kitepdf-core.

Link copied to clipboard
class EpubFormatException(message: String, cause: Throwable? = null) : KiteFormatException

Raised when bytes are not a readable EPUB: no container, no OPF, empty spine.

Link copied to clipboard
class EpubLink

A tappable link region on an EpubPage. rect is in display space (y-down; y-min stored in KiteRectangle.bottom). href is either zipPath#fragment (internal, resolve with the document's href navigation) or an external URL. kind says what the link is for, such as a note reference, which a reader can open in place with EpubDocument.linkTarget.

Link copied to clipboard

What a link is for, read from the link's own markup: its epub:type from the EPUB 3 Structural Semantics Vocabulary, its DPUB-ARIA role, or the rel that EPUB 2 converters write. A reader can open a note in place instead of turning the page. EpubLink.kind carries it.

Link copied to clipboard

The element an internal link points at, read from the book's markup without laying its chapter out. EpubDocument.linkTarget builds it.

Link copied to clipboard

Publication metadata surfaced to a reader UI: Dublin Core fields plus the cover image and reading direction. Paths are zip-absolute.

Link copied to clipboard

One reflowed EPUB page: paints backgrounds/borders, then text lines and images.

Link copied to clipboard

One stop in a page's reading order: what a screen reader would announce, in the order it would announce it.

Link copied to clipboard

What a piece of content IS, for readers that speak rather than draw. Taken from the source element, so <h2> is a heading whatever CSS does to it and a styled <div> that only looks like one is not.

Link copied to clipboard
data class EpubSettings(val pageWidth: Double = 400.0, val pageHeight: Double = 640.0, val fontSize: Double = 12.0, val margin: Double = 36.0, val fontFamily: ReaderFontFamily? = null, val lineHeightScale: Double = 1.0, val textColor: RgbColor? = null, val backgroundColor: RgbColor? = null, val justify: Boolean? = null, val usePublisherCss: Boolean = true, val layoutCacheBytes: Long = 48L * 1024 * 1024, val hyphenate: Boolean? = null)

Reader layout settings. All values in points. Change them at runtime with EpubDocument.withSettings (or the withFontSize/withPageSize/withMargin shorthands) to re-flow without re-parsing the book.

Link copied to clipboard

What the element a link points at is, read from its own epub:type or role, else from the section that holds it.

Link copied to clipboard

Generic font family a reader app can force via EpubSettings.fontFamily.

Link copied to clipboard

A publication's navigation tree, from EPUB 3 nav.xhtml or EPUB 2 toc.ncx.

Link copied to clipboard
class TocEntry

One table-of-contents node. spineIndex is -1 when the target isn't in the spine.

Link copied to clipboard

Moved to core so non-EPUB zip formats (CBZ) can read archives too.

Functions

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).