Options
All
  • Public
  • Public/Protected
  • All
Menu

Intended for internal use between the ReaderView and Renderers.

Provides a linear stream of IRenderableDocumentPage ("Page") objects from a list of IReaderDocuments. IRenderableDocumentPageStream is typically used by IRenderer implementations to load Pages specialized for that renderer.

IRenderableDocumentPageStream instances delivers the right "kind" of Page depending on how the content is to be presented given IRenderer.getSpreadSupport() and IRenderer.getSupportedFlowModes()

The stream is traversable in both directions. Page objects can also be randomly accessed and loaded using ContentLocations.

Reference counting is used to detect when pages should be destroyed. For example, if you call loadFirstPage() twice, you will receive the SAME instance twice. To unload that page, you need to call unloadPage() twice.

Hierarchy

  • IRenderableDocumentPageStream

Index

Methods

destroy

  • destroy(): void
  • Destroys this instance, all pages currently loading or loaded will be unloaded/destroyed. Any async load* call that has not yet completed will be canceled and the returned Promise rejected.

    Returns void

fetchEstimatedHeightPerReaderDocument

  • fetchEstimatedHeightPerReaderDocument(): Promise<number[]>
  • Fetch the estimated clientHeight for each reader document.

    Returns Promise<number[]>

fetchNumberOfPagesPerReaderDocument

  • fetchNumberOfPagesPerReaderDocument(estimate: boolean, onProgressCallback: (progress: number) => void): Promise<number[]>
  • Fetch the exact or estimated number of pages for each reader document.

    Parameters

    • estimate: boolean

      If true, use an estimation algorithm to determine the approxiamte number of pages per document. The algorithm is specific to underlying format adapter. If false, fetch exact number of pages per document. This is a very expensive operation as reflowable documents need to be completely rendered.

    • onProgressCallback: (progress: number) => void

      Callback used for notifying about the progress of the operation.

        • (progress: number): void
        • Parameters

          • progress: number

          Returns void

    Returns Promise<number[]>

isDestroyed

  • isDestroyed(): boolean
  • If this instance has been destroyed.

    Returns boolean

isFirstPage

  • Returns true if the specified Page is the first Page in the stream.

    Parameters

    Returns boolean

isLastPage

  • Returns true if the specified Page is the last Page in the stream.

    Parameters

    Returns boolean

isLastPageOfReaderDocument

  • Returns true if the specified Page is the last Page of its parent reader document.

    Parameters

    Returns boolean

isReaderDocumentLoaded

  • Check if anything has been loaded from the specified readerDocument.

    Parameters

    Returns boolean

loadFirstPage

  • Loads the first Page in the stream.

    Returns Promise<IRenderableDocumentPage>

    A Promise resolved with the Page instance.

loadNextPage

  • Loads the next Page relative to another Page. If referencePage is the last Page in the stream, the returned Promise will be rejected.

    Parameters

    Returns Promise<IRenderableDocumentPage>

    A Promise resolved with the Page instance.

loadPageByContentLocation

loadPageByReaderDocumentPageIndex

  • Loads a Page by page index from the specified reader document.

    Parameters

    • readerDocument: IReaderDocument

      The reader document to load from.

    • pageIndex: number

      The page index starting from 0. This value will be capped if specifying a pageIndex out of range.

    Returns Promise<IRenderableDocumentPage>

    A Promise resolved with the Page instance.

loadPreviousPage

  • Loads the previous Page relative to another Page. If referencePage is the first Page in the stream, the returned Promise will be rejected.

    Parameters

    Returns Promise<IRenderableDocumentPage>

    A Promise resolved with the Page instance.

unloadPage

  • Unloads a previously loaded page. If this causes the reference count for that Page to reach 0, the page will be destroyed.

    Parameters

    Returns void

Generated using TypeDoc