Skip to main content
Version: Next

API reference

Components​

NameDescription
ReadiumViewRenders a publication: an EPUB or PDF on iOS and Android, or a web publication on web.
ReadiumViewRefMoves the reader, searches and zooms; get it with a ref on ReadiumView.
ReadiumPropsThe props of ReadiumView.

Hooks​

NameDescription
UseSearchResultWhat useSearch returns: the accumulated results, their state, and the actions.
useSearchDrives paginated full-text search for a ReadiumView.

Functions​

FunctionDescription
describePublicationErrorThe default English description of a PublicationErrorCode, as message reports it.

Interfaces​

InterfaceDescription
Dimensions-
LinkAn interface representing the Readium Link object. Extends the Nitro spec Link with an optional properties bag and supports hierarchical TOC via nested children.
PreferencesHow the reader lays out and styles a publication: theme, font size, margins and the rest. Readium's defaults apply to anything left out, and PublicationReadyEvent.capabilities says which of these the publication you opened responds to.
PublicationMetadataPublication metadata following Readium Web Publication Manifest spec. Extends the Nitro spec metadata with the @type field.
PublicationReadyEvent-
ZoomEventReports the reader's magnification, including changes the reader makes with a pinch or a double tap rather than through setZoom.
ReadiumFileThe publication a ReadiumView opens.
DecorationStyleHow a decoration looks.
DecorationOne annotation rendered over the publication, such as a highlight.
DecorationGroupA named set of decorations, such as "highlights".
RectWhere something is on screen, as reported with a tapped decoration below.
PointA single position, in the same coordinates as Rect.
DecorationActivatedEvent-
PublicationErrorEventSomething went wrong with a publication; code says what.
LocatorLocationsWhere in its resource a Locator points.
LocatorTextText around a location, e.g. a search match in context.
LocatorA location in a publication, as Readium describes it: reading positions, bookmarks, highlights and search results are all locators. Store them as they are to reopen there later.
ContributorWhat a publication says about itself: title, authors, subjects, accessibility and where it belongs in a series.
Subject-
SeriesInfo-
BelongsTo-
AccessibilityCertification-
Accessibility-
PreferencesChangedEventReported by onPreferencesChanged once preferences are applied.
SearchOptions-
SearchResult-
SearchPageA single page of search results, returned by search() and loadMoreSearchResults(). Results are paginated lazily: keep calling loadMoreSearchResults() while hasMore is true.
SelectionActionAn item added to the text-selection menu.
SelectionEventReported by onSelectionChange as the user adjusts a selection.
SelectionActionEventReported by onSelectionAction when the user picks one of the selectionActions.
ResolveSourceRequestWhat resolveSource is being asked to resolve.
PublicationSourceWhere a publication's bytes are, as opposed to which publication it is.
SourceRequestFailureA request the library made for the publication, which failed.

References​

File​

Renames and re-exports ReadiumFile

Type Aliases​

Type AliasDescription
DecorationGroups-
ReaderColumnCountLegacyThe column counts kept for compatibility.
ReaderColumnCountHow many columns a reflowable publication is laid out in: one, two, or whatever suits the viewport.
PublicationErrorCodeWhat went wrong with a publication. - protectionNotSupported: protected with a scheme no registered content protection handles. - restricted: a protection matched but refused access, e.g. an expired license. - cancelled: restricted with no error, e.g. the passphrase prompt was dismissed. - readFailed: a read of an open publication failed and was not recovered. The only code that does not mean the publication failed to open; see the event's stage.
PublicationErrorStageWhether a publication failed to open, or failed to be read after it was open.
PublicationErrorKindFor a read failure, whether a status was readable at all. 'unreadable' covers a host that omits CORS headers from its errors, which withholds the status from a web reader; native always has one.
ReaderFontFamilyFont families Readium knows by name, including the ones it ships.
ReaderImageFilterWhat to do with a publication's images in a dark theme.
ReaderReadingProgressionWhich way the reader turns pages: left to right, or right to left.
ReaderSpreadWhether two pages are shown side by side, as in a printed book.
ReaderTextAlignHow a publication's text is aligned, where the publication allows it.
ReaderThemeThe reader's colour scheme.
ReaderFitHow a PDF's page is sized to the view.
ReaderScrollAxisWhich way a scrolled PDF scrolls.
CapabilitiesSomething the reader can do with the publication it opened.
SourceRequestReasonWhy a location is being asked for.

Variables​

VariableDescription
RANGESThe range of each numeric preference, as [min, max], e.g. for a slider.