Colibrio Reader Framework API - Cloud license
    Preparing search index...

    Format specific API for a PDF ReaderPublication.

    interface IPdfReaderPublication {
        createContentPositionTimeline(
            readerDocuments: IReaderDocument[],
            options?: PdfContentPositionTimelineOptions,
            progressCallback?: (progress: number) => void,
        ): Promise<IContentPositionTimeline>;
        createTtsSyncMediaTimeline(
            readerDocuments: IReaderDocument[],
            options?: ISyncMediaTtsTimelineBuilderOptions,
            progressCallback?: (progress: number) => void,
        ): Promise<ISyncMediaTimeline>;
        destroy(): void;
        fetchContentLocation(
            locator:
                | ILocator
                | ILocatorData
                | IReaderPublicationNavigationItemData
                | IReaderPublicationNavigationItem,
        ): Promise<IContentLocation>;
        fetchPreferredPageAspectRatio(): Promise<number>;
        fetchPublicationNavigation(): Promise<IReaderPublicationNavigation>;
        fetchUnresolvedContentLocation(
            locator:
                | ILocator
                | ILocatorData
                | IReaderPublicationNavigationItemData
                | IReaderPublicationNavigationItem,
        ): Promise<IUnresolvedContentLocation>;
        getAvailableContentPositionTimelineUnits(): ContentPositionTimelineUnit[];
        getAvailableSyncMediaFormats(): SyncMediaFormat[];
        getDefaultLocatorUrl(): string;
        getLocatorFactory(): ILocatorFactory;
        getOptions(): DeepRequired<IPdfReaderPublicationOptions>;
        getReaderPublicationStorage(): IReaderPublicationStorage;
        getReadingSystemEngine(): IReadingSystemEngine;
        getSourcePublication(): IPdfPublication;
        getSpine(): IReaderDocument[];
        isDestroyed(): boolean;
        isLocatorSourceUrlInPublication(locator: ILocator | ILocatorData): boolean;
        setOptions(options: IPdfReaderPublicationOptions): void;
        toJSON(): IReaderPublicationData;
    }

    Hierarchy (View Summary)

    Methods

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

      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.

      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.

      • Optionaloptions: PdfContentPositionTimelineOptions

        Options to use for the timeline.

      • OptionalprogressCallback: (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.

      Returns Promise<IContentPositionTimeline>

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

      • Optionaloptions: ISyncMediaTtsTimelineBuilderOptions

        Options to use when building the timeline.

      • OptionalprogressCallback: (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.

      Returns Promise<ISyncMediaTimeline>

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

      Returns void

    • 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

    • 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(true) is called.

      Parameters

      Returns void