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 EpubEmbed

An element that embeds a web document on an EpubPage: an inline frame, or an object whose type is HTML or XHTML (#40). The page paints the embedded document in the box when it is a document of the book (#528, #612), and else an object's fallback. An app can place a web view of its own over rect for a URL outside the book, which the page does not show.

Link copied to clipboard

What kind of element embeds a web document on a page.

Link copied to clipboard
enum class EpubFlow : Enum<EpubFlow>

Whether the author asks for pages or for scrolling: rendition:flow.

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

Where an element is on a page (#36).

Link copied to clipboard
enum class EpubLayout : Enum<EpubLayout>

Whether pages reflow or keep the size the author set: rendition:layout. ROLL, of EPUB 3.4, keeps each chapter's size too and shows the chapters as one strip with no gap, as a webtoon or a scroll reads (#506).

Link copied to clipboard
class EpubLink(val rect: KiteRectangle, val href: String, val kind: EpubLinkKind = EpubLinkKind.LINK)

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
class EpubMedia

A <video> or an <audio> element on an EpubPage: where it sits, what it plays and how. The page paints the poster there, or a plain grey box, so an app can place its own player over rect and read the bytes with EpubDocument.resource. The kitepdf-media artifact is such a player, and draws the play control (#31).

Link copied to clipboard

What a media element plays.

Link copied to clipboard

The media overlay of one chapter: its clips in document order, with nested sequences flattened.

Link copied to clipboard

One source of a media element, in the order the element lists them. href is a zip path, as EpubDocument.resource reads it, or a URL with a scheme. type is the media type that the element or the manifest gives, or null.

Link copied to clipboard

One <track> element of a media element: a WebVTT file of timed text (#483).

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

The media overlay metadata of a book, EPUB 3.3 Media Overlays: how long the narration runs, who reads it, and the classes a reading system gives the element being read (#36). EpubDocument.markNarration gives an element these classes.

Link copied to clipboard

Which way the author asks the reader to hold the device: rendition:orientation.

Link copied to clipboard

One clip of a media overlay: a piece of the text, and the part of an audio file that reads it.

Link copied to clipboard

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

Link copied to clipboard

The side of a two-page spread that the first page of a chapter asks for: page-spread-left, page-spread-right, or rendition:page-spread-center for a page shown alone.

Link copied to clipboard

One stop in a page's reading order.

Link copied to clipboard

How a book, or one chapter of it, asks to be shown: the rendition properties of EPUB 3.3 (the Packages specification, section 4). The book's values come from the package metadata. A chapter's values are the ones its spine entry sets, and the book's values for the rest. A value that is not set, or that this library does not know, reads as the default.

Link copied to clipboard
fun interface EpubResourceFetcher

Fetches a resource that a book names by an absolute https URL instead of a file in its container, such as a font or an image on a web server (EPUB 3.3, 3.6). Reading systems should support such remote resources, and should load them over https only (EPUB Reading Systems 3.3, 3.3), so the book never passes another scheme here: an http URL is refused before it reaches the fetcher (#38).

Link copied to clipboard
typealias EpubRole = KiteRole

What a piece of content is, for readers that speak rather than draw.

Link copied to clipboard

What a viewer needs from a book's scripts, without knowing how they run (#41).

Link copied to clipboard
class EpubScriptSession(val document: EpubDocument, engineFor: (chapter: Int) -> KiteScriptEngine, onConsole: (level: String, message: String) -> Unit = { _, _ -> }, clock: () -> Long? = null, val liveChapters: Int = Int.MAX_VALUE, instanceKey: String? = null, fontOutlines: (text: String, font: FontSpec) -> KitePath?? = null) : EpubScriptHandler, AutoCloseable

Runs the scripts of a book's chapters over the library's own parse and layout (#41).

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, val resourceFetcher: EpubResourceFetcher? = null, val scrolled: 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
enum class EpubSpread : Enum<EpubSpread>

When a reader shows two pages side by side: rendition:spread. The deprecated value portrait reads as BOTH, as EPUB 3.3 asks.

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

What a text track of a media element holds, as the kind of its <track> element says (HTML, the track element).

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.

Properties

Link copied to clipboard

The epub:type that the source declared, or null.

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