PdfPageSource

PdfPageSource

PDF-backed page source.

The PDF is rasterized lazily by the viewer's lazy page loader. This source describes the page set, exposes an internal mutable book for the loader, and warns in the console when page aspect ratios differ.

Constructor

new PdfPageSource()

Source:

Classes

PdfPageSource

Methods

attachTextContent(pages, optionsopt) → {number}

Description:
  • Attaches externally-generated text content to PDF pages.

Source:
Parameters:
Name Type Attributes Default Description
pages Array.<Object>

Text content pages, such as parsed hOCR pages.

options Object <optional>
{}

Attachment options.

Properties
Name Type Attributes Default Description
pageOffset number <optional>
0

Zero-based destination page offset.

Returns:

Number of pages attached.

Type
number

getInternalBook() → {Object}

Description:
  • Returns the mutable book used by Riffle's lazy page loader.

Source:
Returns:

Internal book.

Type
Object

getPageCount() → {number}

Source:
Returns:

Page count.

Type
number

getPageMetadata(index) → {PageMetadata|null}

Source:
Parameters:
Name Type Description
index number

Page index.

Returns:

Page metadata.

Type
PageMetadata | null

(async) openPdf(file) → {Promise.<void>}

Description:
  • Loads a PDF file or ArrayBuffer.

Source:
Parameters:
Name Type Description
file File | ArrayBuffer

PDF file or binary buffer.

Returns:
Type
Promise.<void>