# PDF JS Viewer

(part of package '[Servoy PDF Viewer](/reference/servoyextensions/packages/ui-component-packages/servoy-pdf-viewer.md)')\
Extends designtime/SolutionModel: [JSWebComponent](/reference/servoycore/dev-api/solutionmodel/jswebcomponent.md)\
Extends runtime: [RuntimeWebComponent](/reference/servoycore/dev-api/forms/runtimeform/elements/runtimewebcomponent.md)

pdfJsViewer provides more control and customization options than pdfViewer.\
It is more flexible and can handle advanced features like drawing and digital signatures.\
If customization is not required, consider using pdfViewer.

This is a reference page; many components have detailed usage guides [here](https://docs.servoy.com/guides/develop/application-design/ui-components).

## Properties

### dataProviderID

Bound data provider identifier for the PDF document.\
The dataProviderID can also be a string, containing the URL of the PDF document.\
By using the string, the saving of the PDF document will show the document name.\
For example:\
dataProviderID = '/' + "<https://example.com/path/to/document.pdf>"; or '/' + plugins.file.createFile(path to your local pdf).getRemoteUrl(); Type: [Dataprovider](/reference/servoy-developer/component_and_service_property_types.md#dataprovider)

***

### documentURL

URL of the document to be displayed. Type: [String](/reference/servoycore/dev-api/js-lib/string.md)

***

### enableTooltips

Flag indicating whether tooltips are enabled in the PDF viewer. Type: [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Default Value: false

***

### noCache

When true, prevents caching of the PDF document. Type: [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)

***

### pageNumber

The current page number displayed in the viewer. Type: [Number](/reference/servoycore/dev-api/js-lib/number.md)

***

### showToolbar

Flag indicating whether the toolbar is displayed. Type: [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Default Value: true

***

### styleClass

CSS style classes applied to the PDF viewer component. Type: [Styleclass](/reference/servoy-developer/component_and_service_property_types.md#styleclass)

***

### styleSheet

Media or style sheet applied to the PDF viewer. Type: [Media](/reference/servoy-developer/component_and_service_property_types.md#media)

***

### tabSeq

Tab sequence order for keyboard navigation. Type: [Tabseq](/reference/servoy-developer/component_and_service_property_types.md#tabseq)

***

### visible

Flag indicating whether the PDF viewer is visible. Type: [Visible](/reference/servoy-developer/component_and_service_property_types.md#visible)

***

### zoomLevel

The zoom level for displaying the PDF document. Type: [String](/reference/servoycore/dev-api/js-lib/string.md)

***

## Events

### onPageChanged(pageNumber,previousPageNumber)

Fired when the page in the PDF viewer changes.

**Parameters:**

> * {[Number](/reference/servoycore/dev-api/js-lib/number.md)} pageNumber The page number of the new page that is displayed.
> * {[Number](/reference/servoycore/dev-api/js-lib/number.md)} previousPageNumber The page number of the page that was previously displayed.

***

## API

### getFieldNames()

Returns an array of strings representing the field names.

**Returns:** [Array\<String>](/reference/servoycore/dev-api/js-lib/string.md) An array of field names.

***

### getFieldValues()

Returns a map containing the field values.

**Returns:** [Map](/reference/servoy-developer/component_and_service_property_types.md#map) A map of field values.

***

### getToolbarControlIds()

Returns an array of strings representing the toolbar control IDs.

This should not be used at runtime because it can only be called when the view is visible.\
It is intended for developers to get the names that the current pdfjs viewer internal component supports,\
which can then be used in the solution.

**Returns:** [Array\<String>](/reference/servoycore/dev-api/js-lib/string.md) An array of toolbar control IDs.

***

### reload()

forces a reload of the current url

***

### setFieldControlsVisibility(names,visible)

Sets the visibility of the field controls.

**Parameters:**

> * {[Array\<String>](/reference/servoycore/dev-api/js-lib/string.md)} names - An array of field control names.
> * {[Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)} visible - A boolean indicating the visibility of the field controls.

***

### setFieldValues(values)

Sets the field values.

**Parameters:**

> * {[Map](/reference/servoy-developer/component_and_service_property_types.md#map)} values - A map containing the field values to be set.

***

### setToolbarControlsVisibility(ids,visible)

Sets the visibility of the toolbar controls.

**Parameters:**

> * {[Array\<String>](/reference/servoycore/dev-api/js-lib/string.md)} ids - An array of toolbar control IDs.
> * {[Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)} visible - A boolean indicating the visibility of the toolbar controls.

***

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoyextensions/ui-components/media/pdfjsviewer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
