Options
All
  • Public
  • Public/Protected
  • All
Menu

Format specific API for a PDF ReaderPublication.

Hierarchy

Index

Methods

createContentPositionTimeline

  • Creates a new ContentPosition timeline using the specified list of ReaderDocuments. A ContentPositionTimeline is used for describing positions in ReaderPublication content as integers. The timeline starts at position 0 and its length can be retrieved using getLength().

    Choosing unit of measurement

    The ContentPositionTimeline can be configured with different units of measurement. At this moment, CHARACTERS are not available as a unit of measurement for PDFs. By default, PAGES will be used as unit of measurement.

    PAGES

    The timeline is created by counting all pages in the provided list of ReaderDocuments. Each position in the timeline points to the start of a page.

    DOCUMENTS

    The timeline is created by counting all provided ReaderDocuments.

    Specifying the list of ReaderDocuments

    The passed list of ReaderDocuments is validated according to the following rules:

    • The list must not be empty
    • All ReaderDocuments must belong to this publication.
    • All ReaderDocuments must be ordered as in the publication spine.

    If the passed list of ReaderDocuments fails validation, the returned Promise will be rejected with an error.

    Some examples:

    const spine = readerPublication.getSpine();
    readerPublication.createContentPositionTimeline(spine); // OK!
    readerPublication.createContentPositionTimeline(spine.slice(1, 4)) // OK!
    readerPublication.createContentPositionTimeline(spine.reverse()); // ERROR!

    Parameters

    • readerDocuments: IReaderDocument[]

      The reader documents that should be part of the timeline.

    • Optional options: PdfContentPositionTimelineOptions

      Options to use for the timeline.

    • Optional progressCallback: (progress: number) => void

      A function called several times indicating the create progress as a value between 0 and 1. You can also listen on the event 'contentPositionTimelineCreateProgress' to get this information.

        • (progress: number): void
        • Parameters

          • progress: number

          Returns void

    Returns Promise<IContentPositionTimeline>

createTtsSyncMediaTimeline

  • Creates a TTS SyncMediaTimeline using the ContentBlocks from the specified reader documents.

    The returned promise is rejected if this PDF does not contain any text, i.e. if the resulting timeline is empty.

    Parameters

    • readerDocuments: IReaderDocument[]

      The reader documents that should be part of the timeline.

    • Optional options: ISyncMediaTtsTimelineBuilderOptions

      Options to use when building the timeline.

    • Optional progressCallback: (progress: number) => void

      A function called several times indicating the create progress as a value between 0 and 1. You can also listen on the event 'contentPositionTimelineCreateProgress' to get this information.

        • (progress: number): void
        • Parameters

          • progress: number

          Returns void

    Returns Promise<ISyncMediaTimeline>

destroy

  • destroy(): void
  • Destroy this instance, allowing used resources to be garbage collected. This method has the same effect as calling readingSystemEngine.unloadPublication(),

    Returns void

fetchContentLocation

  • Fetch the resolved IContentLocation from a locator, ILocatorData, URL, URI, URN, IRI.

    In contrast to UnresolvedContentLocation, a ContentLocation knows its position within the publication content and can thereby be used to compare and sort ContentLocation instances synchronously.

    See IContentLocation for more information

    Parameters

    Returns Promise<IContentLocation>

fetchPreferredPageAspectRatio

  • fetchPreferredPageAspectRatio(): Promise<number>

fetchPublicationNavigation

fetchUnresolvedContentLocation

getAvailableContentPositionTimelineUnits

getAvailableSyncMediaFormats

getDefaultLocatorUrl

  • getDefaultLocatorUrl(): string

getLocatorFactory

getOptions

getReaderPublicationStorage

  • Get the IReaderPublicationStorage instance for this publication. Use the returned instance to manage the publication's storage, such as 'localStorage' for EPUB. This allows applications to save and restore the state of the IReaderPublicationStorage across reading-sessions and devices.

    Returns IReaderPublicationStorage

getReadingSystemEngine

getSourcePublication

getSpine

isDestroyed

  • isDestroyed(): boolean

isLocatorSourceUrlInPublication

  • If the source URL of the locator, (that is URL without the hash) matches the any source URL in the Publication.

    If this method returns true, the locator MAY target content in the publication, depending on selectors inside the Locator. If this method return false, the locator DOES NOT target any content in the publication.

    Parameters

    Returns boolean

setOptions

  • Sets new IReaderPublicationOptions for this instance. Existing properties are preserved if they aren't defined in the passed options object. Properties explicitly set to undefined will be restored to their default values.

    Changes affecting the appearance or behavior of the ReaderPublication when used with a ReaderView will not take effect until ReaderView.refresh() is called.

    Parameters

    Returns void

toJSON

Generated using TypeDoc