Book

class Book(source)

Representation of a Book.

All resources of a Book (html, css, xml, fonts, images) are represented as Resources. See getResources() for access to these.

A Book as 3 indexes into these Resources, as per the epub specification.

Spine
these are the Resources to be shown when a user reads the book from start to finish.
Table of Contents
*
The table of contents. Table of Contents references may be in a different order and contain different Resources than the spine, and often do.
*
Guide
The Guide has references to a set of special Resources like the cover page, the Glossary, the copyright page, etc.
*

The complication is that these 3 indexes may and usually do point to different pages. A chapter may be split up in 2 pieces to fit it in to memory. Then the spine will contain both pieces, but the Table of Contents only the first.

The Content page may be in the Table of Contents, the Guide, but not in the Spine. Etc.

Please see the illustration at: doc/schema.svg

Author

paul

jake

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

The book's cover image.

Link copied to clipboard
Link copied to clipboard

The guide; contains references to special sections of the book like colophon, glossary, etc.

Link copied to clipboard

The Book's metadata (titles, authors, etc)

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The collection of all images, chapters, sections, xhtml files, stylesheets, etc that make up the book.

Link copied to clipboard

The sections of the book that should be shown if a user reads the book from start to finish.

Link copied to clipboard

Hrefs of stylesheets that should be auto-linked from every XHTML page at write time. Populated by addStylesheet; consumed by io.documentnode.epub4kmp.epub.StylesheetLinker.

Link copied to clipboard

The Table of Contents of the book.

Link copied to clipboard

Functions

Link copied to clipboard
fun addResource(resource: Resource): Resource

Adds a raw Resource to the book's set of Resources without touching the TableOfContents or Spine.

Link copied to clipboard
fun addSection(title: String?, resource: Resource, fragmentId: String? = null): TOCReference

Adds a resource to the book's set of resources, table of contents and if there is no resource with the id in the spine also adds it to the spine.

fun addSection(parentSection: TOCReference, sectionTitle: String?, resource: Resource, fragmentId: String? = null): TOCReference

Adds the resource to the table of contents of the book as a child section of the given parentSection

Link copied to clipboard

Adds stylesheet as a resource and marks it for auto-linking from every XHTML page at write time.

Link copied to clipboard

Rebuilds the Spine so its order matches the TableOfContents.