Class: PDFDocumentProxy

pdfjsLib~PDFDocumentProxy()

Proxy to a `PDFDocument` in the worker thread.

Constructor

new PDFDocumentProxy()

Source:

Members

allXfaHtml :Object|null

NOTE: This is (mostly) intended to support printing of XFA forms.
Type:
  • Object | null
Source:

annotationStorage :AnnotationStorage

Storage for annotation data in forms.
Type:
  • AnnotationStorage
Source:

fingerprints :Array.<string, (string|null)>

A (not guaranteed to be) unique ID to identify the PDF document. NOTE: The first element will always be defined for all PDF documents, whereas the second element is only defined for *modified* PDF documents.
Type:
  • Array.<string, (string|null)>
Source:

isPureXfa :boolean

True if only XFA form.
Type:
  • boolean
Source:

loadingParams :DocumentInitParameters

A subset of the current {DocumentInitParameters}, which are needed in the viewer.
Type:
  • DocumentInitParameters
Source:

loadingTask :PDFDocumentLoadingTask

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

numPages :number

Total number of pages in the PDF file.
Type:
  • number
Source:

stats :PDFDocumentStats|null

The current statistics about document structures, or `null` when no statistics exists.
Type:
  • PDFDocumentStats | null
Source:

Methods

cleanup(keepLoadedFontsopt) → {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.
Parameters:
Name Type Attributes Default Description
keepLoadedFonts boolean <optional>
false Let fonts remain attached to the DOM. NOTE: This will increase persistent memory usage, hence don't use this option unless absolutely necessary. The default value is `false`.
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.<any>}

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

getCalculationOrderIds() → {Promise.<(Array.<string>|null)>}

Source:
Returns:
A promise that is resolved with an {Array} containing IDs of annotations that have a calculation action, or `null` when no such annotations are present in the PDF file.
Type
Promise.<(Array.<string>|null)>

getData() → {Promise.<TypedArray>}

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

getDestination(id) → {Promise.<(Array.<any>|null)>}

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, or `null` when the named destination is not present in the PDF file.
Type
Promise.<(Array.<any>|null)>

getDestinations() → {Promise.<Object.<string, Array.<any>>>}

Source:
Returns:
A promise that is resolved with a mapping from named destinations to references. This can be slow for large documents. Use `getDestination` instead.
Type
Promise.<Object.<string, Array.<any>>>

getDownloadInfo() → {Promise.<{length: number}>}

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.<{length: number}>

getFieldObjects() → {Promise.<(Object.<string, Array.<Object>>|null)>}

Source:
Returns:
A promise that is resolved with an {Object} containing /AcroForm field data for the JS sandbox, or `null` when no field data is present in the PDF file.
Type
Promise.<(Object.<string, Array.<Object>>|null)>

getJavaScript() → {Promise.<(Array.<string>|null)>}

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.<(Array.<string>|null)>

getJSActions() → {Promise.<(Object|null)>}

Source:
Returns:
A promise that is resolved with an {Object} with the JavaScript actions: - from the name tree (like getJavaScript); - from A or AA entries in the catalog dictionary. , or `null` if no JavaScript exists.
Type
Promise.<(Object|null)>

getMarkInfo() → {Promise.<(MarkInfo|null)>}

Source:
Returns:
A promise that is resolved with a {MarkInfo} object that contains the MarkInfo flags for the PDF document, or `null` when no MarkInfo values are present in the PDF file.
Type
Promise.<(MarkInfo|null)>

getMetadata() → {Promise.<{info: Object, metadata: Metadata}>}

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.<{info: Object, metadata: Metadata}>

getOpenAction() → {Promise.<(any|null)>}

Source:
Returns:
A promise that is resolved with an {Array} containing the destination, or `null` when no open action is present in the PDF.
Type
Promise.<(any|null)>

getOptionalContentConfig() → {Promise.<OptionalContentConfig>}

Source:
Returns:
A promise that is resolved with an OptionalContentConfig that contains all the optional content groups (assuming that the document has any).
Type
Promise.<OptionalContentConfig>

getOutline() → {Promise.<Array.<OutlineNode>>}

Source:
Returns:
A promise that is resolved with an {Array} that is a tree outline (if it has one) of the PDF file.
Type
Promise.<Array.<OutlineNode>>

getPage(pageNumber) → {Promise.<PDFPageProxy>}

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

getPageIndex(ref) → {Promise.<number>}

Parameters:
Name Type Description
ref RefProxy The page reference.
Source:
Returns:
A promise that is resolved with the page index, starting from zero, that is associated with the reference.
Type
Promise.<number>

getPageLabels() → {Promise.<(Array.<string>|null)>}

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.<(Array.<string>|null)>

getPageLayout() → {Promise.<string>}

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

getPageMode() → {Promise.<string>}

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

getPermissions() → {Promise.<(Array.<number>|null)>}

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.<(Array.<number>|null)>

getViewerPreferences() → {Promise.<(Object|null)>}

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.<(Object|null)>

hasJSActions() → {Promise.<boolean>}

Source:
Returns:
A promise that is resolved with `true` if some /AcroForm fields have JavaScript actions.
Type
Promise.<boolean>

saveDocument() → {Promise.<Uint8Array>}

Source:
Returns:
A promise that is resolved with a {Uint8Array} containing the full data of the saved document.
Type
Promise.<Uint8Array>