EpubDocument
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.
Pipeline: ZipReader unzips the OCF container; HtmlParser builds a DOM per spine document; the CSS cascade (StyleResolver, via BoxBuilder) turns each into a LayoutBox tree; BoxLayout resolves the box model (margins, borders, padding, width, inline line breaking with justification) into document-space geometry; Paginator slices it into pages; and EpubPage paints backgrounds, borders, text and images. See EPUB_ROAD_TO_PERFECTION.md.
Properties
EPUB-specific metadata (title, authors, cover path, reading direction).
True for a pre-paginated (fixed-layout) book: one page per spine, no reflow.
Format-neutral title/authors/language for KiteDocument viewers.
Format-neutral outline for KiteDocument viewers: tableOfContents with each href turned into a KiteBookmark target.
Page size, font size and margin. Change at runtime via withSettings.
Navigation tree from EPUB 3 nav.xhtml or EPUB 2 toc.ncx (empty if none).
Functions
A position that survives a re-flow: the chapter, plus how far into its text the page starts. Change the font size and the same words keep the same offset, even though they move to another page.
A reading position for an internal href (chapter3.xhtml#part-two), built without laying anything out. Resolve it with locate, which prepares that one chapter. This is the cheap half of following a link.
The element an internal link points at, to show a note, a glossary entry or a citation in place instead of turning the page (#227). Reads the markup of the target's chapter only, and does not lay it out.
Where bookmark sits now. Prepares its chapter and no other. A fragment wins over an offset; both clamp into range rather than failing.
The location of a global index, or null past what is laid out so far.
The global index of location. Null while any earlier chapter is still unlaid, because the pages before it have not been counted yet.
Zero-based page of an internal href: path.xhtml or path.xhtml#id, zip-root-relative, exactly as EpubPage.links and TocEntry carry them. Null for unknown targets and external URLs; an unknown fragment falls back to its document's first page. This is the navigation half of a link tap: viewers scroll to the returned page.
Lays out one chapter. This is where a book's time goes, so it is also the only thing a reader has to wait for: opening at chapter 20 prepares chapter 20, not chapters 0 to 20.
Find needle across the book, lazily page by page (a UI can show incremental results). Same matching rules as KiteStructuredText.search: case-insensitive by default, line breaks read as one space, a hyphenated line break joins directly, matches never cross blocks.
Shorthand for withSettings changing only the body font size (points).
Shorthand for withSettings changing only the page margin (points).
Shorthand for withSettings changing the page size, e.g. on resize / rotation.