# Class: PDFDocumentProxy

## PDFDocumentProxy

#### new PDFDocumentProxy()

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

Source:
  - display/api.js, line 505

### Members

#### fingerprint

Source:
  - display/api.js, line 522

#### numPages

Source:
  - display/api.js, line 515

### Methods

#### cleanup()

Cleans up resources allocated by the document, e.g. created @font-face.

Source:
  - display/api.js, line 634

#### destroy()

Destroys current document instance and terminates worker.

Source:
  - display/api.js, line 640

#### getAttachments() → {Promise}

Source:
  - display/api.js, line 571

##### Returns:

A promise that is resolved with a lookup table for mapping named attachments to their content.

Type
  Promise

#### getData() → {Promise}

Source:
  - display/api.js, line 613

##### 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:
  - display/api.js, line 556

##### Returns:

A promise that is resolved with all information of the given named destination.

Type
  Promise

#### getDestinations() → {Promise}

Source:
  - display/api.js, line 548

##### 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:
  - display/api.js, line 621

##### 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:
  - display/api.js, line 578

##### Returns:

A promise that is resolved with an array of all the JavaScript strings in the name tree.

Type
  Promise

#### getMetadata() → {Promise}

Source:
  - display/api.js, line 606

##### 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

#### getOutline() → {Promise}

Source:
  - display/api.js, line 597

##### 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 Uint8Array, 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:
  - display/api.js, line 530

##### 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:
  - display/api.js, line 539

##### Returns:

A promise that is resolved with the page index that is associated with the reference.

Type
  Promise

#### getPageLabels() → {Promise}

Source:
  - display/api.js, line 564

##### Returns:

A promise that is resolved with: an Array containing the pageLabels that correspond to the pageIndexes, or `null` when no pageLabels are present in the PDF file.

Type
  Promise

#### getStats() → {Promise}

Source:
  - display/api.js, line 628

##### Returns:

A promise this is resolved with current stats about document structures (see PDFDocumentStats).

Type
  Promise