> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/android/get-started/get-started/cordova/api.md).

# APIs for Cordova / Ionic PDF viewer

Discover the best tips for creating an effective meta description. Learn how to craft compelling and informative descriptions to improve your website's search engine visibility and click-through rates

#### `new NativeViewer(options, element)`

Creates a NativeViewer and embeds it on the HTML page.

**Parameters**

| Name      | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `options` | object | Options passed to the NativeViewer, available options are: — `initialDoc`: string, optional - the URL path to a document to load on startup — `l`: string, optional - the Apryse license key — `disabledElements`: array of string, optional - hides multiple elements in the viewer, see `disableElements` for list of available options — `boundingRect`: object, optional - the bounding box for where NativeViewer should be embedded. If no `boundingRect` is provided, the viewer will be presented full screen. — `topLeftButtonTitle`: string, optional - the menu item for top left navigation button, shown as icon on Android and text on iOS, available options are: `menu`, `close`, `back` — `showTopLeftButton`: boolean, optional - whether to show the top left navigation button |
| `element` | string | An html element. If an element is provided, the viewer will be added at the location specified by `boundingRect`. (If no `boundingRect` is provided, on iOS the viewer will be presented directly over the element itself, and on Android the viewer will be presented full screen.) If no element is provided, the API [`showDocumentViewer()`](#showdocumentviewer) must be used to show the viewer.                                                                                                                                                                                                                                                                                                                                                                                             |

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
var viewerElement = document.getElementById('viewer');
var rect = viewerElement.getBoundingClientRect();
var viewer = new Apryse.NativeViewer({
    l: '<your-key-here>',
    initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_mobile_about.pdf',
    boundingRect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height },
    disabledElements: [
    // hide elements as you wish
    ]
}, viewerElement);
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `disableElements(dataElements)`

Hides multiple elements in the viewer, available options are:

* viewControlsButton
* freeHandToolButton
* highlightToolButton
* underlineToolButton
* squigglyToolButton
* strikeoutToolButton
* rectangleToolButton
* ellipseToolButton
* lineToolButton
* arrowToolButton
* polylineToolButton
* polygonToolButton
* cloudToolButton
* signatureToolButton
* freeTextToolButton
* stickyToolButton
* calloutToolButton
* stampToolButton
* toolsButton
* searchButton
* shareButton
* thumbnailsButton
* listsButton
* thumbnailSlider

**Parameters**

| Name           | Type  | Description            |
| -------------- | ----- | ---------------------- |
| `dataElements` | array | Array of element keys. |

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
// remove search button and line create tool
this.viewer.disableElements([ 'searchButton', 'lineToolButton' ]);
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `disableTools(toolNames)`

Disable multiple tools.

**Parameters**

| Name        | Type  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `toolNames` | array | Array of name of the tools, available options are: — AnnotationEdit — TextSelect — AnnotationCreateSticky — AnnotationCreateFreeHand — AnnotationCreateTextHighlight — AnnotationCreateTextUnderline — AnnotationCreateTextSquiggly — AnnotationCreateTextStrikeout — AnnotationCreateFreeText — AnnotationCreateCallout — AnnotationCreateSignature — AnnotationCreateLine — AnnotationCreateArrow — AnnotationCreatePolyline — AnnotationCreateStamp — AnnotationCreateRectangle — AnnotationCreateEllipse — AnnotationCreatePolygon — AnnotationCreatePolygonCloud — AnnotationCreateDistanceMeasurement — AnnotationCreatePerimeterMeasurement — AnnotationCreateAreaMeasurement |

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
// enable sticky annotation tool and free text tool
this.viewer.disableTools([ 'AnnotationCreateSticky', 'AnnotationCreateFreeText' ]);
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `enableTools(toolNames)`

Enable multiple tools that were previously disabled.

**Parameters**

| Name        | Type  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `toolNames` | array | Array of name of the tools, available options are: — AnnotationEdit — TextSelect — AnnotationCreateSticky — AnnotationCreateFreeHand — AnnotationCreateTextHighlight — AnnotationCreateTextUnderline — AnnotationCreateTextSquiggly — AnnotationCreateTextStrikeout — AnnotationCreateFreeText — AnnotationCreateCallout — AnnotationCreateSignature — AnnotationCreateLine — AnnotationCreateArrow — AnnotationCreatePolyline — AnnotationCreateStamp — AnnotationCreateRectangle — AnnotationCreateEllipse — AnnotationCreatePolygon — AnnotationCreatePolygonCloud — AnnotationCreateDistanceMeasurement — AnnotationCreatePerimeterMeasurement — AnnotationCreateAreaMeasurement |

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
// enable sticky annotation tool and free text tool
this.viewer.disableElements([ 'AnnotationCreateSticky', 'AnnotationCreateFreeText' ]);
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `setToolMode(toolName)`

Sets tool mode.

**Parameters**

| Name       | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ---------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `toolName` | string | Name of the tool, available options are: — AnnotationEdit — TextSelect — AnnotationCreateSticky — AnnotationCreateFreeHand — AnnotationCreateTextHighlight — AnnotationCreateTextUnderline — AnnotationCreateTextSquiggly — AnnotationCreateTextStrikeout — AnnotationCreateFreeText — AnnotationCreateCallout — AnnotationCreateSignature — AnnotationCreateLine — AnnotationCreateArrow — AnnotationCreatePolyline — AnnotationCreateStamp — AnnotationCreateRectangle — AnnotationCreateEllipse — AnnotationCreatePolygon — AnnotationCreatePolygonCloud — AnnotationCreateDistanceMeasurement — AnnotationCreatePerimeterMeasurement — AnnotationCreateAreaMeasurement |

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
// sets the current tool mode to freehand inking
this.viewer.setToolMode('AnnotationCreateFreeHand');
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `loadDocument(documentPath)`

Load a document inside NativeViewer UI.

**Parameters**

| Name           | Type   | Description |
| -------------- | ------ | ----------- |
| `documentPath` | string |             |

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
this.viewer.loadDocument('https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_mobile_about.pdf');
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `showDocumentViewer()`

Shows a previously constructed NativeViewer.

If a `boundingRect` is defined, the viewer will be displayed on top of the web content within the specified rect. If no `boundingRect` is defined, the viewer will be presented full screen.

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
this.viewer.showDocumentViewer();
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/android/get-started/get-started/cordova/api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
