Members
allXfaHtml :Object|null
NOTE: This is (mostly) intended to support printing of XFA forms.
Type:
- Object | null
annotationStorage :AnnotationStorage
Storage for annotation data in forms.
Type:
- AnnotationStorage
canvasFactory :Object
The canvas factory instance.
Type:
- Object
filterFactory :Object
The filter factory instance.
Type:
- Object
fingerprints :Array:.<(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:
isPureXfa :boolean
True if only XFA form.
Type:
- boolean
loadingParams :DocumentInitParameters
A subset of the current {DocumentInitParameters}, which are needed in the viewer.
Type:
- DocumentInitParameters
loadingTask :PDFDocumentLoadingTask
The loadingTask for the current document.
Type:
- PDFDocumentLoadingTask
numPages :number
Total number of pages in the PDF file.
Type:
- number
Methods
cachedPageNumber(ref) → {number|null}
Parameters:
Name | Type | Description |
---|---|---|
ref |
RefProxy | The page reference. |
Returns:
The page number, if it's cached.
- Type
- number | null
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`. |
Returns:
A promise that is resolved when clean-up has finished.
- Type
- Promise
destroy()
Destroys the current document instance and terminates the worker.
getAttachments() → {Promise:.<any:>}
Returns:
A promise that is resolved with a lookup table
for mapping named attachments to their content.
getCalculationOrderIds() → {Promise:.<(Array:.<string:>|null:)>}
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.
getData() → {Promise:.<Uint8Array:>}
Returns:
A promise that is resolved with a
{Uint8Array} containing the raw data of the PDF document.
getDestination(id) → {Promise:.<(Array:.<any:>|null:)>}
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The named destination to get. |
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.
getDestinations() → {Promise:.<Object:.<string:, Array:.<any:>>>}
Returns:
A promise that is resolved
with a mapping from named destinations to references.
This can be slow for large documents. Use `getDestination` instead.
getDownloadInfo() → {Promise:.<{length:: number:}>}
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.
getFieldObjects() → {Promise:.<(Object:.<string:, Array:.<Object:>>|null:)>}
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.
getJSActions() → {Promise:.<(Object:|null:)>}
Returns:
A promise that is resolved with
an {Object} with the JavaScript actions:
- from the name tree.
- from A or AA entries in the catalog dictionary.
, or `null` if no JavaScript exists.
getMarkInfo() → {Promise:.<(MarkInfo:|null:)>}
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.
getMetadata() → {Promise:.<{info:: Object:, metadata:: Metadata:}>}
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.
getOpenAction() → {Promise:.<(any:|null:)>}
Returns:
A promise that is resolved with an {Array}
containing the destination, or `null` when no open action is present
in the PDF.
getOptionalContentConfig(paramsopt) → {Promise:.<OptionalContentConfig:>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
GetOptionalContentConfigParameters |
<optional> |
Optional content config parameters. |
Returns:
A promise that is resolved with
an OptionalContentConfig that contains all the optional content
groups (assuming that the document has any).
getOutline() → {Promise:.<Array:.<OutlineNode:>>}
Returns:
A promise that is resolved with an
{Array} that is a tree outline (if it has one) of the PDF file.
getPage(pageNumber) → {Promise:.<PDFPageProxy:>}
Parameters:
Name | Type | Description |
---|---|---|
pageNumber |
number | The page number to get. The first page is 1. |
Returns:
A promise that is resolved with
a PDFPageProxy object.
getPageIndex(ref) → {Promise:.<number:>}
Parameters:
Name | Type | Description |
---|---|---|
ref |
RefProxy | The page reference. |
Returns:
A promise that is resolved with the page index,
starting from zero, that is associated with the reference.
getPageLabels() → {Promise:.<(Array:.<string:>|null:)>}
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.
getPageLayout() → {Promise:.<string:>}
Returns:
A promise that is resolved with a {string}
containing the page layout name.
getPageMode() → {Promise:.<string:>}
Returns:
A promise that is resolved with a {string}
containing the page mode name.
getPermissions() → {Promise:.<(Array:.<number:>|null:)>}
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.
getViewerPreferences() → {Promise:.<(Object:|null:)>}
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.
hasJSActions() → {Promise:.<boolean:>}
Returns:
A promise that is resolved with `true`
if some /AcroForm fields have JavaScript actions.
saveDocument() → {Promise:.<Uint8Array:>}
Returns:
A promise that is resolved with a
{Uint8Array} containing the full data of the saved document.