> 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/ios/get-started/frameworks/flutter/api.md).

# API for Flutter PDF Viewer

Discover the best tips for writing an effective SEO meta description. Learn how to create engaging and informative descriptions to improve click-through rates. The Apryse iOS SDK streamlines secure do

## Utility Functions

This section is for some static methods for global library initialization, configuration, and utility. They could only be callable as a plugin. Below is an example for [`initialize`](#initialize):

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

```dart
PdftronFlutter.initialize('your_license_key');
```

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

#### `version`

Obtains Apryse SDK version.

**Example**

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

```dart
String version = PdftronFlutter.version;
print('Current Apryse SDK version is: ' + version);
```

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

#### `platformVersion`

Obtains the current platform version.

**Example**

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

```dart
String platformVersion = PdftronFlutter.platformVersion;
print('App is currently running on: ' + platformVersion);
```

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

#### `initialize`

Initializes Apryse SDK with your Apryse commercial license key. You can run Apryse in demo mode by not passing in a string, or by passing an empty string.

**Parameters**

| Name  | Type   | Description                            |
| ----- | ------ | -------------------------------------- |
| `key` | string | **Required** — your Apryse license key |

**Returns**

Returns a Future.

**Example**

Demo mode:

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

```dart
PdftronFlutter.initialize();
```

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

Using commercial license key:

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

```dart
PdftronFlutter.initialize('your_licensey_key');
```

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

#### `setRequestedOrientation`

Changes the orientation of this activity. Android only.

For more information on the native API, see the [Android API reference](https://developer.android.com/reference/android/app/Activity#setRequestedOrientation\(int\)).

**Parameters**

| Name                   | Type | Description                                                                                                                         |
| ---------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `requestedOrientation` | int  | **Required** — A [PTOrientation](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) orientation constant. |

**Returns**

Returns a Future.

**Example**

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

```dart
PdftronFlutter.setRequestedOrientation(0);
```

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

## Viewer Functions

This section is for viewer related non-static methods. They would be callable in both plugin and widget versions. For example, [`openDocument`](#openDocument) is accessible in 2 ways:

Plugin:

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

```dart
void showViewer() async {
  await PdftronFlutter.openDocument('https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_about.pdf');
}
```

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

Widget (DocumentViewController):

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

```dart
void _onDocumentViewCreated(DocumentViewController controller) async {
    await controller.openDocument('https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_about.pdf');
}
```

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

You must choose either the widget or plugin, and use it for all APIs. Mixing widget and plugin APIs will not function correctly. For more information, see [Widget or Plugin](https://github.com/ApryseSDK/pdftron-flutter/blob/publish-prep/README.md#widget-or-plugin).

There are several custom classes used in these APIs: Annot, AnnotWithRect, Field, Rect, AnnotFlag, AnnotWithFlag and CustomToolbar. These classes are listed in [Options](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/options.dart), and the constants that are used in the examples below are all listed in [Constants](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart).

### Document

#### `openDocument`

Opens a document in the viewer with configurations.

**Parameters**

| Name       | Type   | Description                         |
| ---------- | ------ | ----------------------------------- |
| `document` | string | **Required** — path to the document |
| `password` | string | password to an encrypted document   |
| `config`   | object | viewer configuration options        |

**Returns**

Returns a Future that would resolve when document is loaded.

For details regarding the config, please see [Viewer Configurations](#viewer-configurations).

**Example**

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

```dart
var disabledElements = [Buttons.shareButton, Buttons.searchButton];
var disabledTools = [Tools.annotationCreateLine, Tools.annotationCreateRectangle];
var hideDefaultAnnotationToolbars = [DefaultToolbars.annotate, DefaultToolbars.draw];
var config = Config();
config.disabledElements = disabledElements;
config.disabledTools = disabledTools;
config.multiTabEnabled = false;
config.customHeaders = {'headerName': 'headerValue'};
config.hideDefaultAnnotationToolbars = hideDefaultAnnotationToolbars;
config.hideAnnotationToolbarSwitcher = true;
config.continuousAnnotationEditing = true;
var password = 'pdf_password';
await PdftronFlutter.openDocument(_document, password: password, config: config);
```

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

#### `saveDocument`

#### saveDocument

Saves the currently opened document in the viewer and get the absolute path to the document. Must only be called when the document is opened in the viewer.

**Returns**

Returns a Future.

Future Parameters:

| Name | Type   | Description                        |
| ---- | ------ | ---------------------------------- |
| path | string | the location of the saved document |

**Example**

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

```dart
var path = await PdftronFlutter.saveDocument();
```

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

#### `getDocumentPath`

Returns the path of the current document.

**Returns**

Returns a Future.

| Name | Type   | Description       |
| ---- | ------ | ----------------- |
| path | string | the document path |

**Example**

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

```dart
var path = await PdftronFlutter.getDocumentPath();
```

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

#### `openAnnotationList`

Displays the annotation tab of the existing list container. If this tab has been disabled, the method does nothing.

**Returns**

Returns a Future that resolves when the view has loaded.

**Example**

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

```dart
await PdftronFlutter.openAnnotationList();
```

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

#### `openBookmarkList`

Displays the bookmark tab of the existing list container. If this tab has been disabled, the method does nothing.

**Returns**

Returns a Future that resolves when the view has loaded.

**Example**

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

```dart
await PdftronFlutter.openBookmarkList();
```

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

#### `openOutlineList`

Displays the outline tab of the existing list container. If this tab has been disabled, the method does nothing.

**Returns**

Returns a Future that resolves when the view has loaded.

**Example**

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

```dart
await PdftronFlutter.openOutlineList();
```

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

#### `openLayersList`

On Android it displays the layers dialog while on iOS it displays the layers tab of the existing list container. If this tab has been disabled or there are no layers in the document, the method does nothing.

**Returns**

Returns a Future that resolves when the view has loaded.

**Example**

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

```dart
await PdftronFlutter.openLayersList();
```

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

#### `openNavigationLists`

Displays the existing list container. Its current tab will be the one last opened.

**Returns**

Returns a Future that resolves when the view has loaded.

**Example**

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

```dart
await PdftronFlutter.openNavigationLists();
```

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

### Viewer UI Configuration

#### `setLeadingNavButtonIcon`

Sets the file name of the icon to be used for the leading navigation button. The button will use the specified icon if [`showLeadingNavButton`](#showLeadingNavButton) (which by default is true) is true in the config.

**Parameters**

| Name                   | Type   | Description                            |
| ---------------------- | ------ | -------------------------------------- |
| `leadingNavButtonIcon` | string | the icon path to the navigation button |

**Returns**

Returns a Future.

**Example**

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

```dart
PdftronFlutter.setLeadingNavButtonIcon(Platform.isIOS ? 'ic_close_black_24px.png' : 'ic_arrow_back_white_24dp');
```

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

**Note**: to add the image file to your application, please follow the steps below:

Android

1. Add the image resource to the [`example/android/app/src/main/res/drawable`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/example/android/app/src/main/res/drawable/) directory. For details about supported file types and potential compression, check out [Create drawables from resource images](https://developer.android.com/guide/topics/graphics/drawables#drawables-from-images).

![demo-android](https://4149080208-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgY6xtY9ZQd9XMpvWlGM0%2Fuploads%2Fgit-blob-82f36e0009b74429b87ebc59b7ff8889f36c7d55%2Fdfca533f6728146dfbb75113f953809790a151c6-3138x1874.png?alt=media) 2. Now you can use the image in the viewer. For example, if you add `button_close.png` to drawable, you could use `'button_close'` in leadingNavButtonIcon.

iOS

1. After pods has been installed, open the .xcworkspace file for this application in Xcode (in this case, it's [`Runner.xcworkspace`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/example/ios/Runner.xcworkspace)), and navigate through the list below. This would allow you to add resources, in this case, an image, to your project.

* "Project navigator"
* "Runner" (or the app name)
* "Build Phases"
* "Copy Bundle Resources"
* "+".

![](https://4149080208-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgY6xtY9ZQd9XMpvWlGM0%2Fuploads%2Fgit-blob-37564816dcb19c1bdadc99c269c790dc0cb155f3%2Fcdf4f66add8fb5b753c6117e008a85746459da82-2795x1795.png?alt=media)

2. Now you can use the image in the viewer. For example, if you add `button_open.png` to the bundle, you could use `'button_open.png'` in leadingNavButtonIcon.

### Annotation Tools

#### `setToolMode`

Sets the current tool mode.

**Parameters**

| Name       | Type   | Description                                                                                                                                       |
| ---------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `toolMode` | string | One of [`Tools`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) string constants, representing the tool mode to set |

**Returns**

Returns a Future.

**Example**

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

```dart
PdftronFlutter.setToolMode(Tools.annotationCreateEllipse);
```

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

#### `commitTool`

Commits the current tool, only available for multi-stroke ink and poly-shape.

**Returns**

Returns a Future.

Future Parameters:

| Name      | Type | Description                                                         |
| --------- | ---- | ------------------------------------------------------------------- |
| committed | bool | true if either ink or poly-shape tool is committed, false otherwise |

**Example**

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

```dart
var committed = await PdftronFlutter.commitTool();
print("Tool committed: $committed");
```

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

### Page

#### `setCurrentPage`

Sets current page of the document. Page numbers are 1-indexed.

**Parameters**

| Name         | Type | Description                                              |
| ------------ | ---- | -------------------------------------------------------- |
| `pageNumber` | int  | the page number to be set as the current page; 1-indexed |

**Returns**

Returns a Future.

Future Parameters:

| Name    | Type | Description                                |
| ------- | ---- | ------------------------------------------ |
| success | bool | whether the setting process is successful. |

**Example**

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

```dart
var setResult = await controller.setCurrentPage(5);
print('Page set ' + (setResult ? 'successfully' : 'unsuccessfully'));
```

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

#### `getCurrentPage`

Gets current page of the document. Page numbers are 1-indexed.

**Returns**

Returns a Future.

Future Parameters:

| Name        | Type | Description                              |
| ----------- | ---- | ---------------------------------------- |
| currentPage | int  | the current page of the current document |

**Example**

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

```dart
var currentPage = await PdftronFlutter.getCurrentPage();
print("The current page is $currentPage");
```

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

#### `getPageCount`

Gets the total number of pages in the currently displayed document.

**Returns**

Returns a Future.

Future Parameters:

| Name      | Type | Description                            |
| --------- | ---- | -------------------------------------- |
| pageCount | int  | the page count of the current document |

**Example**

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

```dart
var pageCount = await PdftronFlutter.getPageCount();
print("The current doc has $pageCount pages");
```

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

#### `getPageCropBox`

Gets a map object of the crop box for specified page.

**Parameters**

| Name         | Type | Description                                        |
| ------------ | ---- | -------------------------------------------------- |
| `pageNumber` | int  | the page number for the target crop box; 1-indexed |

**Returns**

Returns a Future.

Future Parameters:

| Name    | Type | Description                                                                                                                          |
| ------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------ |
| cropBox | Rect | the crop box information map. It contains information for position (bottom-left: x1, y1; top-right: x2, y2) and size (width, height) |

**Example**

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

```dart
var cropBox = await PdftronFlutter.getPageCropBox(1);
print('The width of crop box for page 1 is: ' + cropBox.width.toString());
```

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

#### `getPageRotation`

Gets the rotation value of the specified page in the current document.

**Parameters**

| Name         | Type | Description                                          |
| ------------ | ---- | ---------------------------------------------------- |
| `pageNumber` | int  | the page number for the target page. It is 1-indexed |

**Returns**

Returns a Future.

Future Parameters:

| Name         | Type | Description                                                            |
| ------------ | ---- | ---------------------------------------------------------------------- |
| pageRotation | int  | the rotation degree of the page, one of 0, 90, 180 or 270 (clockwise). |

**Example**

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

```dart
var pageRotation = await PdftronFlutter.getPageRotation(1);
print("The rotation value of page 1 is $pageRotation");
```

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

#### `gotoPreviousPage`

Go to the previous page of the document. If on first page, it will stay on first page.

**Returns**

Returns a Future.

Future Parameters:

| Name        | Type | Description                                                                                                    |
| ----------- | ---- | -------------------------------------------------------------------------------------------------------------- |
| pageChanged | bool | whether the setting process was successful (no change due to staying in first page counts as being successful) |

**Example**

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

```dart
var pageChanged = await PdftronFlutter.gotoPreviousPage();
if (pageChanged) {
  print("Successfully went to previous page");
}
```

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

#### gotoNextPage

Go to the next page of the document. If on last page, it will stay on last page.

Returns a Future.

Future Parameters:

| Name        | Type | Description                                                                                                   |
| ----------- | ---- | ------------------------------------------------------------------------------------------------------------- |
| pageChanged | bool | whether the setting process was successful (no change due to staying in last page counts as being successful) |

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

```dart
var pageChanged = await PdftronFlutter.gotoNextPage();
if (pageChanged) {
  print("Successfully went to next page");
}
```

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

#### gotoFirstPage

Go to the first page of the document.

Returns a Future.

Future Parameters:

| Name        | Type | Description                                |
| ----------- | ---- | ------------------------------------------ |
| pageChanged | bool | whether the setting process was successful |

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

```js
var pageChanged = await PdftronFlutter.gotoFirstPage();
if (pageChanged) {
  print("Successfully went to first page");
}
```

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

#### gotoLastPage

Go to the last page of the document.

Returns a Future.

Future Parameters:

| Name    | Type | Description                                |
| ------- | ---- | ------------------------------------------ |
| success | bool | whether the setting process was successful |

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

```js
var pageChanged = await PdftronFlutter.gotoLastPage();
if (pageChanged) {
  print("Successfully went to last page");
}
```

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

### Import/Export Annotations

#### importAnnotationCommand

Imports remote annotation command to local document. The XFDF needs to be a valid command format with `<add><modify><delete>` tags.

Parameters:

| Name        | Type   | Description                        |
| ----------- | ------ | ---------------------------------- |
| xfdfCommand | String | the XFDF command string for import |

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

```js
var xfdfCommand = 'xfdfCommand <?xml version="1.0" encoding="UTF-8"?><xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><add><circle style="solid" width="5" color="#E44234" opacity="1" creationdate="D:20201218025606Z" flags="print" date="D:20201218025606Z" name="9d0f2d63-a0cc-4f06-b786-58178c4bd2b1" page="0" rect="56.4793,584.496,208.849,739.369" title="PDF" /></add><modify /><delete /><pdf-info import-version="3" version="2" xmlns="http://www.pdftron.com/pdfinfo" /></xfdf>';
PdftronFlutter.importAnnotationCommand(xfdfCommand);
```

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

#### importAnnotations

Imports XFDF annotation string to current document.

Parameters:

| Name | Type   | Description                                 |
| ---- | ------ | ------------------------------------------- |
| xfdf | String | annotation string in XFDF format for import |

Returns a Future.

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

```js
var xfdf = '<?xml version="1.0" encoding="UTF-8"?>\n<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">\n\t<annots>\n\t\t<circle style="solid" width="5" color="#E44234" opacity="1" creationdate="D:20190729202215Z" flags="print" date="D:20190729202215Z" page="0" rect="138.824,653.226,236.28,725.159" title="" /></annots>\n\t<pages>\n\t\t<defmtx matrix="1.333333,0.000000,0.000000,-1.333333,0.000000,1056.000000" />\n\t</pages>\n\t<pdf-info version="2" xmlns="http://www.pdftron.com/pdfinfo" />\n</xfdf>';
PdftronFlutter.importAnnotations(xfdf);
```

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

#### exportAnnotations

Extracts XFDF from the current document. If `annotationList` is null, export all annotations from the document; else export the valid ones specified.

Parameters:

| Name           | Type          | Description                                                                                                                                   |
| -------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| annotationList | List of Annot | If not null, export the XFDF string for the valid annotations; Otherwise, export the XFDF string for all annotations in the current document. |

Returns a Future.

Future Parameters:

| Name | Type   | Description                      |
| ---- | ------ | -------------------------------- |
| xfdf | String | annotation string in XFDF format |

Exports all annotations:

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

```js
var xfdf = await PdftronFlutter.exportAnnotations(null);
```

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

Exports specified annotations:

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

```js
List<Annot> annotList = new List<Annot>.empty(growable: true);
annotList.add(new Annot('Hello', 1));
annotList.add(new Annot('World', 2));
var xfdf = await PdftronFlutter.exportAnnotations(annotList);
```

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

### Annotations

#### flattenAnnotations

Flattens the forms and (optionally) annotations in the current document.

Parameters:

| Name      | Type | Description                                                                            |
| --------- | ---- | -------------------------------------------------------------------------------------- |
| formsOnly | bool | Defines whether only forms are flattened. If false, all annotations will be flattened. |

Returns a Future.

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

```js
PdftronFlutter.flattenAnnotations(true);
```

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

#### deleteAnnotations

Deletes the specified annotations in the current document.

Parameters:

| Name        | Type          | Description                   |
| ----------- | ------------- | ----------------------------- |
| annotations | List of Annot | the annotations to be deleted |

Returns a Future.

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

```js
List<Annot> annotList = new List<Annot>.empty(growable: true);
annotList.add(new Annot('Hello', 1));
annotList.add(new Annot('World', 2));
PdftronFlutter.deleteAnnotations(annotList);
```

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

#### deleteAllAnnotations

Deletes all annotations in the current document excluding links and widgets.

Returns a Future.

`PdftronFlutter.deleteAllAnnotations();`

#### selectAnnotation

Selects the specified annotation in the current document.

Parameters:

| Name        | Type  | Description                   |
| ----------- | ----- | ----------------------------- |
| annotations | Annot | the annotation to be selected |

Returns a Future.

`PdftronFlutter.selectAnnotation(new Annot('Hello', 1));`

#### setFlagsForAnnotations

Sets flags for specified annotations in the current document.

Parameters:

| Name                    | Type                   | Description                                           |
| ----------------------- | ---------------------- | ----------------------------------------------------- |
| annotationWithFlagsList | List of AnnotWithFlags | a list of annotations with respective flags to be set |

Returns a Future.

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

```js
List<AnnotWithFlags> annotsWithFlags = new List<AnnotWithFlags>.empty(growable: true);
Annot hello = new Annot('Hello', 1);
Annot world = new Annot('World', 3);
AnnotFlag printOn = new AnnotFlag(AnnotationFlags.print, true);
AnnotFlag unlock = new AnnotFlag(AnnotationFlags.locked, false);
// you can add an AnnotWithFlags object flexibly like this:
annotsWithFlags.add(new AnnotWithFlags.fromAnnotAndFlags(hello, [printOn, unlock]));
annotsWithFlags.add(new AnnotWithFlags.fromAnnotAndFlags(world, [unlock]));
// Or simply use the constructor like this:
annotsWithFlags.add(new AnnotWithFlags('Pdftron', 10, AnnotationFlags.no_zoom, true));
PdftronFlutter.setFlagsForAnnotations(annotsWithFlags);
```

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

#### setPropertiesForAnnotation

Sets properties for specified annotation in the current document.

Parameters:

| Name       | Type          | Description                                        |
| ---------- | ------------- | -------------------------------------------------- |
| annotation | Annot         | Annot the annotation to be modified                |
| property   | AnnotProperty | the properties to be set for the target annotation |

For settable properties:

| Name        | Type   | Markup exclusive |
| ----------- | ------ | ---------------- |
| rect        | Rect   | no               |
| contents    | String | no               |
| subject     | String | yes              |
| title       | String | yes              |
| contentRect | Rect   | yes              |
| rotation    | int    | no               |

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

```js
Annot pdf = new Annot('pdf', 1);
AnnotProperty property = new AnnotProperty();
property.rect = new Rect.fromCoordinates(1, 1.5, 100.2, 100);
property.contents = 'Hello World';
property.subject = 'sample';
property.title = 'set-props-for-annot';
property.rotation = 90;
PdftronFlutter.setPropertiesForAnnotation(pdf, property);
```

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

#### setFlagForFields

Sets a field flag value on one or more form fields.

Parameters:

| Name       | Type           | Description                                              |
| ---------- | -------------- | -------------------------------------------------------- |
| fieldNames | List of String | list of field names for which the flag should be set     |
| flag       | int            | the flag to be set, one of the constants from FieldFlags |
| flagValue  | bool           | value to set for flag                                    |

Returns a Future.

`PdftronFlutter.setFlagForFields(['First Name', 'Last Name'], FieldFlags.Required, true);`

#### setValuesForFields

Sets field values on one or more form fields of different types.

Parameters:

| Name   | Type          | Description                                                                                                       |
| ------ | ------------- | ----------------------------------------------------------------------------------------------------------------- |
| fields | List of Field | A list of fields; each field must be set with a name and a value. The value's type can be number, bool or string. |

Returns a Future.

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

```js
PdftronFlutter.setValuesForFields([
      new Field('textField1', "Pdftron"),
      new Field('textField2', 12.34),
      new Field('checkboxField1', true),
      new Field('checkboxField2', false),
      new Field('radioField', 'Yes'),
      new Field('choiceField', 'No')
    ]);
```

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

### Navigation

#### handleBackButton

Handles the back button in search mode. Android only.

Returns a Future.

Future Parameters:

| Name    | Type | Description                                     |
| ------- | ---- | ----------------------------------------------- |
| handled | bool | whether the back button is handled successfully |

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

```js
var handled = await PdftronFlutter.handleBackButton();
print("Back button handled: $handled");
```

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

### Bookmarks

#### importBookmarkJson

Imports user bookmarks into the document. The input needs to be a valid bookmark JSON format.

Parameters:

| Name         | Type   | Description                                                                                                                             |
| ------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| bookmarkJson | String | The bookmark json for import. It needs to be in valid bookmark JSON format, for example {"0": "Page 1"}. The page numbers are 1-indexed |

Returns a Future.

`PdftronFlutter.importBookmarkJson("{\"0\": \"Page 1\", \"3\": \"Page 4\"}");`

#### addBookmark

Creates a new bookmark with the given title and page number.

Parameters:

| Name       | Type   | Description                                           |
| ---------- | ------ | ----------------------------------------------------- |
| title      | String | Title of the bookmark                                 |
| pageNumber | int    | The page number of the new bookmark. It is 1-indexed. |

Returns a Future.

`PdftronFlutter.addBookmark("Page 7", 6);`

### Multi-tab

#### closeAllTabs

Closes all documents that are currently opened in a multiTab environment (that is, [`multiTabEnabled`](#multiTabEnabled) is true in the config).

Returns a Future.

`PdftronFlutter.closeAllTabs();`

## Events

This section contains all the event listeners you could attach to the viewer.

### Document

#### startDocumentLoadedListener

Event is raised when the document finishes loading.

Event Parameters:

| Name | Type   | Description                             |
| ---- | ------ | --------------------------------------- |
| path | String | the path to where the document is saved |

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

```js
var documentLoadedCancel = startDocumentLoadedListener((path)
{
  print("flutter document loaded: $path");
});
```

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

#### startDocumentErrorListener

Event is raised when the document has errors when loading.

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

```js
var documentErrorCancel = startDocumentErrorListener((){
  print("flutter document loaded unsuccessfully");
});
```

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

### Viewer

#### startLeadingNavButtonPressedListener

Event is raised when the leading navigation button is pressed.

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

```js
Dartvar navPressedCancel = startLeadingNavButtonPressedListener(()
{
  print("flutter nav button pressed");
});
```

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

### Page

#### startPageChangedListener

Event is raised when the current page changes.

Event Parameters:

| Name               | Type | Description              |
| ------------------ | ---- | ------------------------ |
| previousPageNumber | int  | the previous page number |
| pageNumber         | int  | the current page number  |

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

```js
var pageChangedCancel = startPageChangedListener((previousPageNumber, pageNumber)
{
  print("flutter page changed. from $previousPageNumber to $pageNumber");
});
```

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

#### startPageMovedListener

Event is raised when a page has been moved in the document.

Event Parameters:

| Name               | Type | Description              |
| ------------------ | ---- | ------------------------ |
| previousPageNumber | int  | the previous page number |
| pageNumber         | int  | the current page number  |

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

```js
var pageMovedCancel = startPageMovedListener((previousPageNumber, pageNumber) {
  print("flutter page moved from $previousPageNumber to $pageNumber");
});
```

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

### Import/Export Annotations

#### startExportAnnotationCommandListener

Event is raised when local annotation changes committed to the document.

Event Parameters:

| Name        | Type   | Description                      |
| ----------- | ------ | -------------------------------- |
| xfdfCommand | String | the XFDF command string exported |

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

```js
var annotCancel = startExportAnnotationCommandListener((xfdfCommand) {
  // local annotation changed
  // upload XFDF command to server here
  print("flutter xfdfCommand: $xfdfCommand");
});
```

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

### Annotations

#### startAnnotationChangedListener

Event is raised when there is a change to annotations to the document.

Event Parameters:

| Name        | Type          | Description                                    |
| ----------- | ------------- | ---------------------------------------------- |
| action      | String        | the action that occurred (add, delete, modify) |
| annotations | List of Annot | the annotations that have been changed         |

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

```js
var annotChangedCancel = startAnnotationChangedListener((action, annotations) 
{
  print("flutter annotation action: ${action}");
  for (Annot annot in annotations) {
    print("annotation has id: ${annot.id}");
    print("annotation is in page: ${annot.pageNumber}");
  }
});
```

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

#### startAnnotationsSelectedListener

Event is raised when annotations are selected.

Event Parameters:

| Name                | Type                  | Description                                         |
| ------------------- | --------------------- | --------------------------------------------------- |
| annotationWithRects | List of AnnotWithRect | The list of annotations with their respective rects |

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

```js
var annotsSelectedCancel = startAnnotationsSelectedListener((annotationWithRects) 
{
  for (AnnotWithRect annotWithRect in annotationWithRects) {
    print("annotation has id: ${annotWithRect.id}");
    print("annotation is in page: ${annotWithRect.pageNumber}");
    print("annotation has width: ${annotWithRect.rect.width}");
  }
});
```

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

#### startFormFieldValueChangedListener

Event is raised when there are changes to form field values.

Event Parameters:

| Name   | Type          | Description                 |
| ------ | ------------- | --------------------------- |
| fields | List of Field | the fields that are changed |

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

```js
var fieldChangedCancel = startFormFieldValueChangedListener((fields)
{
  for (Field field in fields) {
    print("Field has name ${field.fieldName}");
    print("Field has value ${field.fieldValue}");
  }
});
```

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

### Annotation Menu

#### startAnnotationMenuPressedListener

Event is raised on annotation menu pressed if it is passed into [`overrideAnnotationMenuBehavior`](#overrideAnnotationMenuBehavior).

Event Parameters:

| Name               | Type                                     | Description                              |
| ------------------ | ---------------------------------------- | ---------------------------------------- |
| annotationMenuItem | one of the AnnotationMenuItems constants | The menu item that has been pressed      |
| annotations        | List of Annot                            | The annotations associated with the menu |

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

```js
var annotationMenuPressedCancel = startAnnotationMenuPressedListener((annotationMenuItem, annotations) 
{
  print("Annotation menu item " + annotationMenuItem + " has been pressed");
  for (Annot annotation in annotations) {
    print("Annotation has id: ${annotation.id}");
    print("Annotation is in page: ${annotation.pageNumber}");
  }
});
```

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

### Long Press Menu

#### startLongPressMenuPressedListener

Event is raised on long press menu pressed if it is passed into [`overrideLongPressMenuBehavior`](/android/get-started/frameworks/flutter/api.md#overrideLongPressMenuBehavior).

Event Parameters:

| Name              | Type                                    | Description                                           |
| ----------------- | --------------------------------------- | ----------------------------------------------------- |
| longPressMenuItem | one of the LongPressMenuItems constants | The menu item that has been pressed                   |
| longPressText     | string                                  | The selected text if pressed on text, empty otherwise |

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

```js
var longPressMenuPressedCancel = startLongPressMenuPressedListener((longPressMenuItem, longPressText)
{
  print("Long press menu item " + longPressMenuItem + " has been pressed");
  if (longPressText.length > 0) {
    print("The selected text is: " + longPressText);
  }
});
```

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

### Custom Behavior

#### startBehaviorActivatedListener

Event is raised on certain behaviors, if any is passed into [`overrideBehavior`](#overrideBehavior).

action | String, one of the [`Behaviors`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/API.md#Behaviors) constants | The behavior which has been activated data | map | detailed information regarding the behavior

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

```js
var behaviorActivatedCancel = startBehaviorActivatedListener((action, data) {
  print('action is ' + action);
  print('url is ' + data['url']);
```

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

### Bookmarks

#### startExportBookmarkListener

Event is raised when user bookmark changes committed to the document.

Event Parameters:

| Name         | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| bookmarkJson | String | the bookmark json string exported |

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

```js
var bookmarkCancel = startExportBookmarkListener((bookmarkJson) {
  print("flutter bookmark: ${bookmarkJson}");
});
```

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

### Zoom

#### startZoomChangedListener

Event is raised when zoom ratio is changed in the current document.

Event Parameters:

| Name | Type   | Description                                   |
| ---- | ------ | --------------------------------------------- |
| zoom | double | the zoom ratio in the current document viewer |

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

```js
var zoomChangedCancel = startZoomChangedListener((zoom) 
{
  print("flutter zoom changed. Current zoom is: $zoom");
});
```

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

## Viewer Configurations

This section is the configuration part of the [`openDocument`](#openDocument) function. You could also refer to [Config](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/config.dart) for all mutable properties.

### Document

#### customHeaders

map\<string, string>, defaults to empty.

Defines custom headers to use with HTTP/HTTPS requests.

`config.customHeaders = {'headerName': 'headerValue'};`

#### readOnly

bool, defaults to false.

Defines whether the viewer is read-only. If true, the UI will not allow the user to change the document.

`config.readOnly = true;`

#### defaultEraserType

one of the [`DefaultEraserType`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, optional

Sets the default eraser tool type. Value only applied after a clean install.

Eraser TypeDescription`annotationEraser`Erases everything as an object; if you touch ink, the entire object is erased.`hybrideEraser`Erases ink by pixel, but erases other annotation types as objects.`inkEraser`Erases ink by pixel only. Android only.

`config.defaultEraserType = DefaultEraserType.inkEraser;`

#### isBase64String

bool, defaults to false.

If true, document in [`openDocument`](#openDocument) will be treated as a base64 string.

When viewing a document initialized with a base64 string (i.e. a memory buffer), a temporary file is created on Android, but not on iOS. (If you need access to a file-backed PDF on iOS, save the base64 string to disk, and open the file located at that path.)

`config.isBase64String = true;`

#### base64FileExtension

String, defaults to .pdf, required if using base64 string of a non-pdf file.

Defines the file extension for the base64 string in document, if [`isBase64String`](#isBase64String) is true.

### UI Customization

#### disabledElements

array of [`Buttons`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, defaults to none.

Defines buttons to be disabled for the viewer.

`var disabledElements = [Buttons.shareButton, Buttons.searchButton]; config.disabledElements = disabledElements;`

#### disabledTools

array of [`Tools`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, defaults to none.

Defines tools to be disabled for the viewer.

`var disabledTools = [Tools.annotationCreateLine, Tools.annotationCreateRectangle]; config.disabledTools = disabledTools;`

#### showLeadingNavButton

bool, defaults to true.

Defines whether to show the leading navigation button.

`config.showLeadingNavButton = true;`

### Toolbar Customization

#### annotationToolbars

array of [`CustomToolbar`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/options.dart) objects or [`DefaultToolbars`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants.

Defines custom toolbars. If passed in, the set of default toolbars will no longer appear. It is possible to mix and match with default toolbars. See example below:

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

```js
// Viewer will use a custom defined toolbar and a default annotate toolbar in this case
var customToolbar = new CustomToolbar('myToolbar', 'myToolbar', [Tools.annotationCreateArrow, Tools.annotationCreateCallout], ToolbarIcons.favorite);
var annotationToolbars = [DefaultToolbars.annotate, customToolbar];
```

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

#### hideDefaultAnnotationToolbars

array of [`DefaultToolbars`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, defaults to none.

Defines which default annotation toolbars should be hidden. Note that this should be used when [`annotationToolbars`](#annotationToolbars) is not defined.

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

```js
// Viewer will use all the default toolbars except annotate or draw in this case
var hideDefaultAnnotationToolbars = [DefaultToolbars.annotate, DefaultToolbars.draw];
config.hideDefaultAnnotationToolbars = hideDefaultAnnotationToolbars;
```

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

#### hideAnnotationToolbarSwitcher

bool, defaults to false.

Defines whether to show the toolbar switcher in the top toolbar.

`config.hideAnnotationToolbarSwitcher = true;`

#### hideTopToolbars

bool, defaults to false.

Defines whether to hide both the top app nav bar and the annotation toolbar.

`config.hideTopToolbars = true;`

#### hideTopAppNavBar

bool, defaults to false.

Defines whether to hide the top navigation app bar.

`config.hideTopAppNavBar = true;`

#### hideBottomToolbar

bool, defaults to false.

Defines whether to hide the bottom toolbar for the current viewer.

`config.hideBottomToolbar = true;`

### Layout

#### fitMode

one of the [`FitModes`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, default value is 'FitWidth'.

Defines the fit mode (default zoom level) of the viewer.

`config.fitMode = FitModes.fitHeight;`

#### layoutMode

one of the [`LayoutModes`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, default value is 'Continuous'.

Defines the layout mode of the viewer.

`config.layoutMode = LayoutModes.facingCover;`

### Page

#### initialPageNumber

number, optional.

Defines the initial page number that viewer displays when the document is opened. Note that page numbers are 1-indexed.

`config.initialPageNumber = 5;`

#### pageChangeOnTap

bool, defaults to true.

Defines whether the viewer should change pages when the user taps the edge of a page, while the viewer is in a horizontal viewing mode.

`config.pageChangeOnTap = true;`

#### pageIndicatorEnabled

bool, defaults to true.

Defines whether to show the page indicator for the viewer.

`config.pageIndicatorEnabled = true;`

#### pageNumberIndicatorAlwaysVisible

bool, defaults to false.

Defines whether the page indicator will always be visible.

`config.pageNumberIndicatorAlwaysVisible = true;`

### Annotations

#### annotationPermissionCheckEnabled

bool, defaults to false.

Defines whether annotation's flags will be taken into account when it is selected, for example, an annotation with a locked flag can not be resized or moved.

`config.annotationPermissionCheckEnabled = true;`

#### annotationAuthor

String.

Defines the author name for all annotations created on the current document. Exported xfdfCommand will include this piece of information.

`config.annotationAuthor = 'Apryse';`

#### continuousAnnotationEditing

bool, defaults to true.

If true, the active annotation creation tool will remain in the current annotation creation tool. Otherwise, it will revert to the "pan tool" after an annotation is created.

`config.continuousAnnotationEditing = true;`

#### selectAnnotationAfterCreation

bool, defaults to true.

Defines whether an annotation is selected after it is created. On iOS, this functions for shape and text markup annotations only.

`config.selectAnnotationAfterCreation = true;`

#### disableEditingByAnnotationType

array of [`Tools`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, defaults to none.

Defines annotation types that cannot be edited after creation.

`config.disableEditingByAnnotationType = [Tools.annotationCreateTextSquiggly, Tools.annotationCreateTextHighlight, Tools.annotationCreateEllipse];`

### Annotation Menu

#### hideAnnotationMenu

array of [`Tools`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, defaults to none

Defines annotation types that will not show the default annotation menu.

`config.hideAnnotationMenu = [Tools.annotationCreateArrow, Tools.annotationEraserTool];`

#### annotationMenuItems

array of [`AnnotationMenuItems`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, default contains all items

Defines the menu items that can show when an annotation is selected.

`config.annotationMenuItems = [AnnotationMenuItems.search, AnnotationMenuItems.share];`

#### overrideAnnotationMenuBehavior

array of [`AnnotationMenuItems`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, defaults to none

Defines the menu items that will skip default behavior when pressed. They will still be displayed in the annotation menu, and the event handler [`startAnnotationMenuPressedListener`](#startAnnotationMenuPressedListener) will be called from which custom behavior can be implemented.

`config.overrideAnnotationMenuBehavior = [AnnotationMenuItems.copy];`

### Long Press Menu

#### longPressMenuEnabled

bool, defaults to true

Defines whether to show the popup menu of options after the user long presses on text or blank space on the document.

`config.longPressMenuEnabled = false;`

#### longPressMenuItems

array of [`LongPressMenuItems`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, optional, default contains all the items

Defines menu items that can be shown when long pressing on text or blank space.

`config.longPressMenuItems = [LongPressMenuItems.search, LongPressMenuItems.share];`

#### overrideLongPressMenuBehavior

array of [`LongPressMenuItems`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, optional, defaults to none

Defines the menu items on long press that will skip default behavior when pressed. They will still be displayed in the long press menu, and the event handler [`startLongPressMenuPressedListener`](#startLongPressMenuPressedListener) will be called where custom behavior can be implemented.

`config.overrideLongPressMenuBehavior = [LongPressMenuItems.copy];`

### Custom Behavior

#### overrideBehavior

array of [`Behaviors`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, defaults to false.

Defines actions that should skip default behavior, such as external link click. The event handler [`startBehaviorActivatedListener`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/API.md#startBehaviorActivatedListener) will be called when the behavior is activated, where custom behavior can be implemented.

`config.overrideBehavior = [Behaviors.linkPress];`

### Multi-tab

#### multiTabEnabled

bool, defaults to false.

Defines whether viewer will use tabs in order to have more than one document open simultaneously (like a web browser). Calling [`openDocument`](#openDocument) with this value being true will cause a new tab to be opened with the associated document.

`config.multiTabEnabled = true;`

#### tabTitle

String, default is the file name.

Sets the tab title if [`multiTabEnabled`](#multiTabEnabled) is true. (For Android, tabTitle is only supported on the widget viewer)

`config.tabTitle = 'tab1';`

### Signature

#### signSignatureFieldsWithStamps

bool, defaults to false.

Defines whether signature fields will be signed with image stamps. This is useful if you are saving XFDF to remote source.

`config.signSignatureFieldsWithStamps = true;`

#### showSavedSignatures

bool, defaults to true.

Defines whether to show saved signatures for re-use when using the signing tool.

`config.showSavedSignatures = true;`

### Thumbnail Browser

#### thumbnailViewEditingEnabled

bool, defaults to true.

Defines whether user can modify the document using the thumbnail view (e.g. add/remove/rotate pages).

`config.thumbnailViewEditingEnabled = false;`

#### hideThumbnailFilterModes

array of [`ThumbnailFilterModes`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, defaults to none.

Defines filter Modes that should be hidden in the thumbnails browser.

`config.hideThumbnailFilterModes = [ThumbnailFilterModes.annotated];`

### View Mode Dialog

#### hideViewModeItems

array of [`ViewModePickerItem`](https://github.com/ApryseSDK/pdftron-flutter/blob/master/lib/constants.dart) constants, optional, defaults to none.

Defines view mode items to be hidden in the view mode dialog.

`config.hideViewModeItems=[ViewModePickerItem.ColorMode, ViewModePickerItem.Crop];`

### Others

#### autoSaveEnabled

bool, dafaults to true.

Defines whether document is automatically saved by the viewer.

`config.autoSaveEnabled = true;`

#### useStylusAsPen

bool, defaults to true.

Defines whether a stylus should act as a pen when in pan mode. If false, it will act as a finger.

`config.useStylusAsPen = true;`

#### followSystemDarkMode

bool, Android only, defaults to true.

Defines whether the UI will appear in a dark color when the system is dark mode. If false, it will use viewer setting instead.

`config.followSystemDarkMode = false;`


---

# 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 dynamically by asking a question.

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

```
GET https://docs.apryse.com/ios/get-started/frameworks/flutter/api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
