Class: PDFDocumentProxy

pdfjsLib~PDFDocumentProxy()

Proxy to a PDFDocument in the worker thread. Also, contains commonly used properties that can be read synchronously.

Constructor

new PDFDocumentProxy()

Source:

Members

fingerprint :string

A (not guaranteed to be) unique ID to identify a PDF.
Type:
  • string
Source:

loadingParams :Object

A subset of the current {DocumentInitParameters}, which are either needed in the viewer and/or whose default values may be affected by the `apiCompatibilityParams`.
Type:
  • Object
Source:

loadingTask :PDFDocumentLoadingTask

The loadingTask for the current document.
Type:
  • PDFDocumentLoadingTask
Source:

numPages :number

Total number of pages the PDF contains.
Type:
  • number
Source:

Methods

cleanup() → {Promise}

Cleans up resources allocated by the document, on both the main- and worker-threads. NOTE: Do not, under any circumstances, call this method when rendering is currently ongoing since that may lead to rendering errors.
Source:
Returns:
A promise that is resolved when clean-up has finished.
Type
Promise

destroy()

Destroys the current document instance and terminates the worker.
Source:

getAttachments() → {Promise}

Source:
Returns:
A promise that is resolved with a lookup table for mapping named attachments to their content.
Type
Promise

getData() → {Promise}

Source:
Returns:
A promise that is resolved with a {TypedArray} that has the raw data from the PDF.
Type
Promise

getDestination(id) → {Promise}

Parameters:
Name Type Description
id string The named destination to get.
Source:
Returns:
A promise that is resolved with all information of the given named destination.
Type
Promise

getDestinations() → {Promise}

Source:
Returns:
A promise that is resolved with a lookup table for mapping named destinations to reference numbers. This can be slow for large documents. Use `getDestination` instead.
Type
Promise

getDownloadInfo() → {Promise}

Source:
Returns:
A promise that is resolved when the document's data is loaded. It is resolved with an {Object} that contains the `length` property that indicates size of the PDF data in bytes.
Type
Promise

getJavaScript() → {Promise}

Source:
Returns:
A promise that is resolved with an {Array} of all the JavaScript strings in the name tree, or `null` if no JavaScript exists.
Type
Promise

getMetadata() → {Promise}

Source:
Returns:
A promise that is resolved with an {Object} that has `info` and `metadata` properties. `info` is an {Object} filled with anything available in the information dictionary and similarly `metadata` is a {Metadata} object with information from the metadata section of the PDF.
Type
Promise

getOpenAction() → {Promise}

Source:
Returns:
A promise that is resolved with an {Object} containing the currently supported actions, or `null` when no OpenAction exists.
Type
Promise

getOutline() → {Promise}

Source:
Returns:
A promise that is resolved with an {Array} that is a tree outline (if it has one) of the PDF. The tree is in the format of: [ { title: string, bold: boolean, italic: boolean, color: rgb Uint8ClampedArray, count: integer or undefined, dest: dest obj, url: string, items: array of more items like this }, ... ]
Type
Promise

getPage(pageNumber) → {Promise}

Parameters:
Name Type Description
pageNumber number The page number to get. The first page is 1.
Source:
Returns:
A promise that is resolved with a PDFPageProxy object.
Type
Promise

getPageIndex(ref) → {Promise}

Parameters:
Name Type Description
ref Object The page reference. Must have the `num` and `gen` properties.
Source:
Returns:
A promise that is resolved with the page index (starting from zero) that is associated with the reference.
Type
Promise

getPageLabels() → {Promise}

Source:
Returns:
A promise that is resolved with an {Array} containing the page labels that correspond to the page indexes, or `null` when no page labels are present in the PDF file.
Type
Promise

getPageLayout() → {Promise}

Source:
Returns:
A promise that is resolved with a {string} containing the page layout name.
Type
Promise

getPageMode() → {Promise}

Source:
Returns:
A promise that is resolved with a {string} containing the page mode name.
Type
Promise

getPermissions() → {Promise}

Source:
Returns:
A promise that is resolved with an {Array} that contains the permission flags for the PDF document, or `null` when no permissions are present in the PDF file.
Type
Promise

getStats() → {Promise}

Source:
Returns:
A promise this is resolved with current statistics about document structures (see PDFDocumentStats).
Type
Promise

getViewerPreferences() → {Promise}

Source:
Returns:
A promise that is resolved with an {Object} containing the viewer preferences, or `null` when no viewer preferences are present in the PDF file.
Type
Promise