diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..c99b88c6e --- /dev/null +++ b/.eslintignore @@ -0,0 +1,8 @@ +# Build +lib + +# Auto-gen Docs +docs + +# Example folder +example \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..ef6bd0e69 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,26 @@ +{ + "env": { + "es2021": true + }, + "extends": [ + "standard" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 12, + "sourceType": "module" + }, + "rules": { + "max-len":["error", { "code": 100, "ignoreUrls": true }], + "no-trailing-spaces": "off", + "quotes": "off", + "@typescript-eslint/no-unused-vars": "off", + "semi": "off", + "quote-props": ["error", "consistent"], + "prettier/prettier": "off", + "no-use-before-define": "off", + "padded-blocks": "off", + "react-native/no-inline-styles": "off", + "import/export": "off" + } +} diff --git a/.github/workflows/jsBuilder.yml b/.github/workflows/jsBuilder.yml index ddf74b7d8..f21025949 100644 --- a/.github/workflows/jsBuilder.yml +++ b/.github/workflows/jsBuilder.yml @@ -13,20 +13,21 @@ jobs: with: persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token. fetch-depth: 0 # otherwise, you will failed to push refs to dest repo. - ref: ${{ github.event.pull_request.head.sha }} + ref: ${{ github.event.pull_request.head.sha }} # checks out the branch being merged into `master` - - name: Install dependencies - run: | - npm i - - name: Node setup uses: actions/setup-node@v2 with: - node-version: '16' + node-version: '14' cache: 'npm' + cache-dependency-path: 'package.json' + + - name: Install dependencies + run: | + npm i - name: Build JavaScript files - run: | # Change last line to your build script command #. + run: | # Change line to your build script command. npm run start - name: Force add JS files to override .gitignore @@ -36,11 +37,10 @@ jobs: run: | # Change last line to your preferred commit message (I like `chore: build js files`). git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" - git commit -m "Updating JS files" -a || echo "No changes to commit" + git commit -m "Updating JS files" -a || echo "No commit needed. JS files are already up-to-date" - name: Push changes uses: ad-m/github-push-action@v0.6.0 with: - force: true github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.event.pull_request.head.ref }} \ No newline at end of file + branch: ${{ github.event.pull_request.head.ref }} # pushes the commit to the branch being merged into `master` diff --git a/.gitignore b/.gitignore index a2a179893..8736afe2c 100644 --- a/.gitignore +++ b/.gitignore @@ -49,4 +49,4 @@ example/android/app/src/main/assets/index.android.bundle example/android/app/src/main/assets/index.android.bundle.meta # Build -/lib \ No newline at end of file +/lib diff --git a/.npmignore b/.npmignore index ba0fcd823..f4299aaa6 100644 --- a/.npmignore +++ b/.npmignore @@ -46,4 +46,7 @@ buck-out/ *.keystore example/android/app/src/main/assets/index.android.bundle -example/android/app/src/main/assets/index.android.bundle.meta \ No newline at end of file +example/android/app/src/main/assets/index.android.bundle.meta + +# Auto-gen Docs +docs diff --git a/API.md b/API.md deleted file mode 100644 index d4a6105e6..000000000 --- a/API.md +++ /dev/null @@ -1,3403 +0,0 @@ -# PDFTron React Native API - -## TypeScript - -PDFTron React Native supports TypeScript. Since not all customers use the language, the typings used in this document will be described using normal JavaScript types. For TypeScript users, type information is automatically provided while coding, and exact type aliases and constants used in our custom typings can be found in [AnnotOptions](src/AnnotOptions) and [Config](src/Config) source folders. - -## RNPdftron - -RNPdftron contains static methods for global library initialization, configuration, and utility methods. - -### initialize -Initializes PDFTron SDK with your PDFTron commercial license key. You can run PDFTron in demo mode by passing an empty string. - -Parameters: - -Name | Type | Description ---- | --- | --- -licenseKey | string | your PDFTron license key - -```js -RNPdftron.initialize('your_license_key'); -``` - -### enableJavaScript -Enables JavaScript for PDFTron SDK, by default it is enabled. - -Parameters: - -Name | Type | Description ---- | --- | --- -enabled | bool | whether to enable or disable JavaScript - -```js -RNPdftron.enableJavaScript(true); -``` - -### getVersion -Gets the current PDFNet version. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -version | string | current PDFNet version - -```js -RNPdftron.getVersion().then((version) => { - console.log("Current PDFNet version:", version); -}); -``` - -### getPlatformVersion -Gets the version of current platform (Android/iOS). - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -platformVersion | string | current platform version (Android/iOS) - -```js -RNPdftron.getPlatformVersion().then((platformVersion) => { - console.log("App currently running on:", platformVersion); -}); -``` - -### getSystemFontList -Gets the font list available on the OS (Android only). -This is typically useful when you are mostly working with non-ascii characters in the viewer. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -fontList | string | the font list available on Android - -```js -RNPdftron.getSystemFontList().then((fontList) => { - console.log("OS font list:", fontList); -}); -``` - -### clearRubberStampCache -Clear the information and bitmap cache for rubber stamps (Android only). -This is typically useful when the content of rubber stamps has been changed in the viewer. - -Returns a promise. - -```js -RNPdftron.clearRubberStampCache().then(() => { - console.log("Rubber stamp cache cleared"); -}); -``` - -### encryptDocument -Encrypts (password-protect) a document (must be a PDF). **Note**: This function does not lock the document it cannot be used it while the document is opened in the viewer. - -Parameters: - -Name | Type | Description ---- | --- | --- -file path | string | the local file path to the file -password | string | the password you would like to set -current password | string | the current password, use empty string if no password - -Returns a promise. - -Example: - -```js -RNPdftron.encryptDocument("/sdcard/Download/new.pdf", "1111", "").then(() => { - console.log("done password"); -}); -``` - -### pdfFromOfficeTemplate -Generates a PDF using a template in the form of an Office document and replacement data in the form of a JSON object. -For more information please see our [template guide](https://www.pdftron.com/documentation/core/guides/generate-via-template/). - -Parameters: - -Name | Type | Description ---- | --- | --- -docxPath | string | the local file path to the template file -json | object | the replacement data in the form of a JSON object - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -resultPdfPath | string | the local file path to the generated PDF - -The user is responsible for cleaning up the temporary file that is generated. - -Example: - -```js -RNPdftron.pdfFromOfficeTemplate("/sdcard/Download/red.docx", json).then((resultPdfPath) => { - console.log(resultPdfPath); -}); -``` - -#### exportAsImage -Export a PDF page to an image format defined in [`Config.ExportFormat`](./src/Config/Config.ts). - -Unlike DocumentView.exportAsImage, this method is static and should only be called *before* a `DocumentView` instance has been created or else unexpected behaviour can occur. This method also takes a local file path to the desired PDF. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageNumber | int | the page to be converted; if the value does not refer to a valid page number, the file path will be undefined -dpi | double | the output image resolution -exportFormat | string | one of [`Config.ExportFormat`](./src/Config/Config.ts) constants -filePath | string | local file path to pdf - -Returns a Promise. - -Name | Type | Description ---- | --- | --- -resultImagePath | string | the temp path of the created image, user is responsible for clean up the cache - -```js -RNPdftron.exportAsImage(1, 92, Config.ExportFormat.BMP, "/sdcard/Download/red.pdf").then((resultImagePath) => { - console.log('export', resultImagePath); -}); -``` - -## DocumentView - Props - -A React component for displaying documents of different types such as PDF, docx, pptx, xlsx and various image formats. - -### Open a Document - -#### document -string, required - -The path or url to the document. - -Example: - -```js - -``` - -#### password -string, optional - -The password of the document, if any. - -Example: - -```js - -``` - -#### isBase64String -bool, optional, defaults to false - -If true, [`document`](#document) prop will be treated as a base64 string. If it is not the base64 string of a pdf file, [`base64FileExtension`](#base64FileExtension) is required. - -When viewing a document initialized with a base64 string (i.e. a memory buffer), a temporary file is created on Android and iOS. - -```js - -``` - -#### base64FileExtension -string, required if using base64 string of a non-pdf file, defaults to ".pdf" - -The file extension for the base64 string in [`document`](#document), if [`isBase64String`](#isBase64String) is true. - -```js - -``` - -#### customHeaders -object, optional - -Defines custom headers to use with HTTP/HTTPS requests. - -```js - -``` - -#### readOnly -bool, optional, defaults to false - -Defines whether the viewer is read-only. If true, the UI will not allow the user to change the document. - -```js - -``` -#### defaultEraserType -one of the [`Config.EraserType`](./src/Config/Config.ts) constants, optional - -Sets the default eraser tool type. Value only applied after a clean install. - -Eraser Type | Description ---- | --- -`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. - -```js - -``` - -#### exportPath -string, optional - -Sets the folder path for all save options, this defaults to the app cache path. Android only. -Example: - -```js - -``` - -#### openUrlPath -string, optional - -Sets the cache folder used to cache PDF files opened using a http/https link, this defaults to the app cache path. Android only. -Example: - -```js - -``` - -#### saveStateEnabled -bool, optional, default to true - -Sets whether to remember the last visited page and zoom for a document if it gets opened again. -Example: - -```js - -``` - -#### openSavedCopyInNewTab -bool, optional, default to true, Android only. - -Sets whether the new saved file should open after saving. -Example: - -```js - -``` - -#### onDocumentLoaded -function, optional - -This function is called when the document finishes loading. - -Parameters: - -Name | Type | Description ---- | --- | --- -path | string | File path that the document has been saved to - -```js - { - console.log('The document has finished loading:', path); - }} -/> -``` - -#### onDocumentError -function, optional - -This function is called when document opening encounters an error. - -Parameters: - -Name | Type | Description ---- | --- | --- -error | string | Error message produced - -```js - { - console.log('Error occured during document opening:', error); - }} -/> -``` - -### UI Customization - -#### disabledElements -array of [`Config.Buttons`](./src/Config/Config.ts) constants, optional, defaults to none - -Defines buttons to be disabled for the viewer. - -```js - -``` - -#### disabledTools -array of [`Config.Tools`](./src/Config/Config.ts) constants, optional, defaults to none - -Defines tools to be disabled for the viewer. - -```js - -``` - -#### onToolChanged -function, optional - -This function is called when the current tool changes to a new tool - -Parameters: - -Name | Type | Description ---- | --- | --- -previousTool | string | the previous tool (one of the [`Config.Tools`](./src/Config/Config.ts) constants or "unknown tool"), representing the tool before change -tool | string | the current tool (one of the [`Config.Tools`](./src/Config/Config.ts) constants or "unknown tool"), representing the current tool - -```js - { - console.log('Tool has been changed from', previousTool, 'to', tool); - }} -/> -``` - -#### rememberLastUsedTool -boolean, optional, defaults to true, Android only - -Defines whether the last tool used in the current viewer session will be the tool selected upon starting a new viewer session. - -Example: - -```js - -``` - -#### leadingNavButtonIcon -string, optional - -The file name of the icon to be used for the leading navigation button. The button will use the specified icon if it is valid, and the default icon otherwise. - -Example: - -```js - -``` - -**Note**: to add the image file to your application, please follow the steps below: - -##### Android -1. Add the image resource to the drawable directory in [`example/android/app/src/main/res`](./example/android/app/src/main/res). For details about supported file types and potential compression, check out [here](https://developer.android.com/guide/topics/graphics/drawables#drawables-from-images). - -demo-android - -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 [`example.xcworkspace`](./example/ios/example.xcworkspace)), and navigate through the list below. This would allow you to add resources, in this case, an image, to your project. -- "Project navigator" -- "example" (or the app name) -- "Build Phases" -- "Copy Bundle Resources" -- "+". - -demo-ios - -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. - - -#### showLeadingNavButton -bool, optional, defaults to true - -Defines whether to show the leading navigation button. - -```js - -``` - -#### onLeadingNavButtonPressed -function, optional - -This function is called when the leading navigation button is pressed. - -```js - { - console.log('The leading nav has been pressed'); - }} -/> -``` - -#### documentSliderEnabled -bool, optional, defaults to true - -Defines whether the document slider of the viewer is enabled. - -```js - -``` - -#### hideViewModeItems -array of [`Config.ViewModePickerItem`](./src/Config/Config.ts) constants, optional, defaults to none. - -Defines view mode items to be hidden in the view mode dialog. - -```js - -``` - -#### tabletLayoutEnabled -bool, optional, defaults to true - -Defines whether the tablet layout should be used on tablets. Otherwise uses the same layout as phones. Android only. - -```js - -``` - -#### downloadDialogEnabled -bool, optional, defaults to true - -Defines whether the download dialog should be shown. Android only. - -```js - -``` - -### Toolbar Customization - -#### topToolbarEnabled -bool, optional, defaults to true - -Deprecated. Use [`hideTopAppNavBar`](#hideTopAppNavBar) prop instead. - -#### bottomToolbarEnabled -bool, optional, defaults to true - -Defines whether the bottom toolbar of the viewer is enabled. - -```js - -``` - -#### annotationToolbars -array of [`Config.DefaultToolbars`](./src/Config/Config.ts) constants or custom toolbar objects, optional, defaults to none - -Defines custom toolbars. If passed in, the default toolbars will no longer appear. -It is possible to mix and match with default toolbars. See example below: - -```js -const myToolbar = { - [Config.CustomToolbarKey.Id]: 'myToolbar', - [Config.CustomToolbarKey.Name]: 'myToolbar', - [Config.CustomToolbarKey.Icon]: Config.ToolbarIcons.FillAndSign, - [Config.CustomToolbarKey.Items]: [Config.Tools.annotationCreateArrow, Config.Tools.annotationCreateCallout, Config.Buttons.undo] -}; - -... - -``` -#### hideDefaultAnnotationToolbars -array of [`Config.DefaultToolbars`](./src/Config/Config.ts) constants, optional, defaults to none - -Defines which default annotation toolbars should be hidden. Note that this prop should be used when [`annotationToolbars`](#annotationToolbars) is not defined. - -```js - -``` - -#### hideAnnotationToolbarSwitcher -bool, optional, defaults to false - -Defines whether to show the toolbar switcher in the top toolbar. - -```js - -``` - -#### initialToolbar -one of the [`Config.DefaultToolbars`](./src/Config/Config.ts) constants or the `id` of a custom toolbar object, optional, defaults to none - -Defines which [`annotationToolbar`](#annotationToolbars) should be selected when the document is opened. - -```js - -``` - -#### hideTopToolbars -bool, optional, defaults to false - -Defines whether to hide both the top app nav bar and the annotation toolbar. - -```js - -``` - -#### hideTopAppNavBar -bool, optional, defaults to false - -Defines whether to hide the top navigation app bar. - -```js - -``` - -#### hideToolbarsOnTap -bool, optional, defaults to true - -Defines whether an unhandled tap in the viewer should toggle the visibility of the top and bottom toolbars. When false, the top and bottom toolbar visibility will not be toggled and the page content will fit between the bars, if any. - -```js - -``` - -#### topAppNavBarRightBar -array of [`Config.Buttons`](./src/Config/Config.ts) constants, optional, iOS only - -Customizes the right bar section of the top app nav bar. If passed in, the default right bar section will not be used. - -```js - -``` - -#### bottomToolbar -array of [`Config.Buttons`](./src/Config/Config.ts) constants, optional, only the outline list, thumbnail list, share, view mode, search, and reflow buttons are supported on Android - -Defines a custom bottom toolbar. If passed in, the default bottom toolbar will not be used. - -```js - -``` - -#### padStatusBar -bool, optional, defaults to false, android only - -Defines whether the viewer will add padding to take account of the system status bar. - -```js - -``` - -### Layout - -#### fitMode -one of the [`Config.FitMode`](./src/Config/Config.ts) constants, optional, default value is `Config.FitMode.FitWidth` - -Defines the fit mode (default zoom level) of the viewer. - -```js - -``` - -#### layoutMode -one of the [`Config.LayoutMode`](./src/Config/Config.ts) constants, optional, default value is `Config.LayoutMode.Continuous` - -Defines the layout mode of the viewer. - -```js - -``` - -#### onLayoutChanged -function, optional - -This function is called when the layout of the viewer has been changed. - -```js - { - console.log('Layout has been updated.'); - }} -/> -``` - -### Page - -#### initialPageNumber -number, optional - -Defines the initial page number that viewer displays when the document is opened. Note that page numbers are 1-indexed. - -```js - -``` - -#### pageNumber -number, optional - -Defines the currently displayed page number. Different from [`initialPageNumber`](#initialPageNumber), changing this prop value at runtime will change the page accordingly. - -```js - -``` - -#### pageChangeOnTap -bool, optional, defaults to true - -Defines whether the viewer should change pages when the user taps the edge of a page, when the viewer is in a horizontal viewing mode. - -```js - -``` - -#### pageIndicatorEnabled -bool, optional, defaults to true - -Defines whether to show the page indicator for the viewer. - -```js - -``` - -#### keyboardShortcutsEnabled -bool, optional, defaults to true, iOS only - -Defines whether the keyboard shortcuts of the viewer are enabled. - -```js - -``` - -#### onPageChanged -function, optional - -This function is called when the page number has been changed. - -Parameters: - -Name | Type | Description ---- | --- | --- -previousPageNumber | int | the previous page number -pageNumber | int | the current page number - -```js - { - console.log('Page number changes from', previousPageNumber, 'to', pageNumber); - }} -/> -``` - -#### onPageMoved -function, optional - -This function is called when a page has been moved in the document. - -Parameters: - -Name | Type | Description ---- | --- | --- -previousPageNumber | int | the previous page number -pageNumber | int | the current page number - -```js - { - console.log('Page moved from', previousPageNumber, 'to', pageNumber); - }} -/> -``` - -### Zoom - -#### onZoomChanged -function, optional - -This function is called when the zoom scale has been changed. - -Parameters: - -Name | Type | Description ---- | --- | --- -zoom | double | the current zoom ratio of the document - -```js - { - console.log('Current zoom ratio is', zoom); - }} -/> -``` - -#### onZoomFinished -function, optional - -This function is called when a zooming has been finished. For example, if zoom via gesture, this is called on gesture release. - -Parameters: - -Name | Type | Description ---- | --- | --- -zoom | double | the current zoom ratio of the document - -```js - { - console.log('Current zoom ratio is', zoom); - }} -``` - -### Scroll - -#### horizontalScrollPos -number, optional - -Defines the horizontal scroll position in the current document viewer. - -```js - -``` - -#### verticalScrollPos -number, optional - -Defines the vertical scroll position in the current document viewer. - -```js - -``` - -#### onScrollChanged -function, optional - -This function is called when the scroll position has been changed. - -Parameters: - -Name | Type | Description ---- | --- | --- -horizontal | number | the horizontal position of the scroll -vertical | number | the vertical position of the scroll - -```js - { - console.log('Current scroll position is', horizontal, 'horizontally, and', vertical, 'vertically.'); - }} -``` - -#### hideScrollbars -bool, optional, iOS only, defaults to false - -Determines whether scrollbars will be hidden on the viewer. - -```js - -``` - -### Reflow - -#### imageInReflowEnabled -bool, optional, defaults to true - -Whether to show images in reflow mode. - -```js - -``` - -#### reflowOrientation -one of the [`Config.ReflowOrientation`](./src/Config/Config.ts) constants, optional, default value is `Config.ReflowOrientation.Horizontal`. Android only. - -Sets the scrolling direction of the reflow control. - -```js - -``` - -### Annotation Menu - -#### hideAnnotationMenu -array of [`Config.Tools`](./src/Config/Config.ts) constants, optional, defaults to none - -Defines annotation types that will not show in the annotation (long-press) menu. - -```js - -``` - -#### annotationMenuItems -array of [`Config.AnnotationMenu`](./src/Config/Config.ts) constants, optional, default contains all the items - -Defines the menu items that can show when an annotation is selected. - -```js - -``` - -#### overrideAnnotationMenuBehavior -array of [`Config.AnnotationMenu`](./src/Config/Config.ts) constants, optional, 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 function [`onAnnotationMenuPress`](#onAnnotationMenuPress) will be called where custom behavior can be implemented. - -```js - -``` - -#### onAnnotationMenuPress -function, optional - -This function is called when an annotation menu item passed in to [`overrideAnnotationMenuBehavior`](#overrideAnnotationMenuBehavior) is pressed. - -Parameters: - -Name | Type | Description ---- | --- | --- -annotationMenu | string | One of [`Config.AnnotationMenu`](./src/Config/Config.ts) constants, representing which item has been pressed -annotations | array | An array of `{id: string, pageNumber: number, type: string, screenRect: object, pageRect: object}` objects.

`id` is the annotation identifier and `type` is one of the [`Config.Tools`](./src/Config/Config.ts) constants. `screenRect` was formerly called `rect`. Both rects are represented with `{x1: number, y1: number, x2: number, y2: number, width: number, height: number}` objects. - -```js - { - console.log('Annotation menu item', annotationMenu, 'has been pressed'); - annotations.forEach(annotation => { - console.log('The id of selected annotation is', annotation.id); - console.log('The page number of selected annotation is', annotation.pageNumber); - console.log('The type of selected annotation is', annotation.type); - console.log('The screenRect of selected annotation is', annotation.screenRect); - console.log('The pageRect of selected annotation is', annotation.pageRect); - }); - }} -/> -``` - -### Long Press Menu - -#### longPressMenuEnabled -bool, optional, defaults to true - -Defines whether to show the popup menu of options when the user long presses on text or blank space on the document. - -```js - -``` - -#### longPressMenuItems -array of [`Config.LongPressMenu`](./src/Config/Config.ts) constants, optional, default contains all the items - -Defines menu items that can show when long press on text or blank space. - -```js - -``` - -#### overrideLongPressMenuBehavior -array of [`Config.LongPressMenu`](./src/Config/Config.ts) 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 function [`onLongPressMenuPress`](#onLongPressMenuPress) will be called where custom behavior can be implemented. - -```js - -``` - -#### onLongPressMenuPress -function, optional - -This function is called if the pressed long press menu item is passed in to [`overrideLongPressMenuBehavior`](#overrideLongPressMenuBehavior) - -Parameters: - -Name | Type | Description ---- | --- | --- -longPressMenu | string | One of [`Config.LongPressMenu`](./src/Config/Config.ts) constants, representing which item has been pressed -longPressText | string | the selected text if pressed on text, empty otherwise - -```js - { - console.log('Long press menu item', longPressMenu, 'has been pressed'); - if (longPressText !== '') { - console.log('The selected text is', longPressText); - } - }} -/> -``` - -### Custom Behavior - -#### overrideBehavior -array of [`Config.Actions`](./src/Config/Config.ts) constants, optional, defaults to none - -Defines actions that will skip default behavior, such as external link click. The function [`onBehaviorActivated`](#onBehaviorActivated) will be called where custom behavior can be implemented, whenever the defined actions occur. - -```js - -``` - -#### onBehaviorActivated -function, optional - -This function is called if the activated behavior is passed in to [`overrideBehavior`](#overrideBehavior) - -Parameters: - -Name | Type | Description ---- | --- | --- -action | string | One of [`Config.Actions`](./src/Config/Config.ts) constants, representing which action has been activated -data | object | A JSON object that varies depending on the action - -Data param table: - -Action | Data param ---- | --- -[`Config.Actions.linkPress`](./src/Config/Config.ts) | `{url: string}` -[`Config.Actions.stickyNoteShowPopUp`](./src/Config/Config.ts) | `{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`. Type is one of the [`Config.Tools`](./src/Config/Config.ts) constants. `screenRect` was formerly called `rect`. - -```js - { - console.log('Activated action is', action); - if (action === Config.Actions.linkPress) { - console.log('The external link pressed is', data.url); - } else if (action === Config.Actions.stickyNoteShowPopUp) { - console.log('Sticky note has been activated, but it would not show a pop up window.'); - } - }} -/> -``` - -### Multi-tab - -#### multiTabEnabled -bool, optional, defaults to false - -Defines whether viewer will use tabs in order to have more than one document open simultaneously (like a web browser). Changing the [`document`](#document) prop value will cause a new tab to be opened with the associated file. - -```js - -``` - -#### tabTitle -string, optional, default is the file name - -Set the tab title if [`multiTabEnabled`](#multiTabEnabled) is true. - -```js - -``` - -#### maxTabCount -number, optional, defaults to unlimited - -Sets the limit on the maximum number of tabs that the viewer could have at a time. Open more documents after reaching this limit will overwrite the old tabs. - -```js - -``` - -#### onTabChanged -function, optional - -The function is activated when a tab is changed. - -Please note that this API is meant for tab-specific changes. If you would like to know when the document finishes loading instead, see the [`onDocumentLoaded`](#onDocumentLoaded) event. - -Parameters: - -Name | Type | Description ---- | --- | --- -currentTab | string | The file path of current tab's document - - -```js - { - console.log("The current tab is ", currentTab); - }} -/> -``` - -### Collaboration - -#### collabEnabled -bool, optional, defaults to false - -Defines whether to enable realtime collaboration. If true then `currentUser` must be set as well for collaboration mode to work. Feature set may vary between local and collaboration mode. - -```js - -``` - -#### currentUser -string, required if [`collabEnabled`](#collabEnabled) is set to true - -Defines the current user. Created annotations will have their title (author) set to this string. - -```js - -``` - -#### currentUserName -string, optional - -Defines the current user name. Will set the user name only if [`collabEnabled`](#collabEnabled) is true and [`currentUser`](#currentUser) is defined. This should be used only if you want the user's display name to be different than the annotation's title/author (in the case that `currentUser` is an ID rather than a human-friendly name.) - -```js - -``` - -#### annotationManagerEditMode -one of the [`Config.AnnotationManagerEditMode`](./src/Config/Config.js) constants, optional, default value is `Config.AnnotationManagerEditMode.Own` - -Sets annotation manager edit mode when [`collabEnabled`](#collabEnabled) is true. - -Mode | Description ---- | --- -`Config.AnnotationManagerEditMode.Own` | In this mode, you can edit only your own changes -`Config.AnnotationManagerEditMode.All` | In this mode, you can edit everyone's changes - -```js - -``` - -#### annotationManagerUndoMode -one of the [`Config.AnnotationManagerUndoMode`](./src/Config/Config.js) constants, optional, default value is `Config.AnnotationManagerUndoMode.Own` - -Sets annotation manager undo mode when [`collabEnabled`](#collabEnabled) is true. - -Mode | Description ---- | --- -`Config.AnnotationManagerUndoMode.Own` | In this mode, you can undo only your own changes -`Config.AnnotationManagerUndoMode.All` | In this mode, you can undo everyone's changes - -```js - -``` - -#### replyReviewStateEnabled -boolean, optional, Android only, defaults to true - -Defines whether to show an annotation's reply review state. - -```js - -``` - -### Annotations - -#### annotationPermissionCheckEnabled -bool, optional, defaults to false - -Defines whether an annotation's permission flags will be respected when it is selected. For example, a locked annotation can not be resized or moved. - -```js - -``` - -#### annotationAuthor -string, optional - -Defines the author name for all annotations created on the current document. Exported xfdfCommand will include this piece of information. - -```js - -``` - -#### continuousAnnotationEditing -bool, optional, 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. - -```js - -``` - -#### inkMultiStrokeEnabled -bool, optional, defaults to true - -If true, ink tool will use multi-stroke mode. Otherwise, each stroke is a new ink annotation. - -```js - -``` - -#### selectAnnotationAfterCreation -bool, optional, defaults to true - -Defines whether an annotation is selected after it is created. On iOS, this functions for shape and text markup annotations only. - -```js - -``` - -#### onExportAnnotationCommand -function, optional - -This function is called if a change has been made to annotations in the current document. Unlike [`onAnnotationChanged`](#onAnnotationChanged), this function has an XFDF command string as its parameter. If you are modifying or deleting multiple annotations, then on Android the function is only called once, and on iOS it is called for each annotation. - - -Parameters: - -Name | Type | Description ---- | --- | --- -action | string | the action that occurred (add, delete, modify) -xfdfCommand | string | an xfdf string containing info about the edit -annotations | array | an array of annotation data. When collaboration is enabled data comes in the format `{id: string}`, otherwise the format is `{id: string, pageNumber: number, type: string}`. In both cases, the data represents the annotations that have been changed. `type` is one of the [`Config.Tools`](./src/Config/Config.ts) constants - -**Known Issues**
-On iOS, there is currently a bug that prevents the last XFDF from being retrieved when modifying annotations while collaboration mode is enabled. - -```js - { - console.log('Annotation edit action is', action); - console.log('The exported xfdfCommand is', xfdfCommand); - annotations.forEach((annotation) => { - console.log('Annotation id is', annotation.id); - if (!this.state.collabEnabled) { - console.log('Annotation pageNumber is', annotation.pageNumber); - console.log('Annotation type is', annotation.type); - } - }); - }} - collabEnabled={this.state.collabEnabled} - currentUser={'Pdftron'} -/> -``` - -#### onAnnotationsSelected -function, optional - -This function is called when an annotation(s) is selected. - -Parameters: - -Name | Type | Description ---- | --- | --- -annotations | array | array of annotation data in the format `{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`, representing the selected annotations. Type is one of the [`Config.Tools`](./src/Config/Config.ts) constants. `screenRect` was formerly called `rect`. - -```js - { - annotations.forEach(annotation => { - console.log('The id of selected annotation is', annotation.id); - console.log('It is in page', annotation.pageNumber); - console.log('Its type is', annotation.type); - }); - }} -/> -``` - -#### onAnnotationChanged -function, optional - -This function is called if a change has been made to an annotation(s) in the current document. - -Note: When an annotation is flattened, it also gets deleted, so both [`onAnnotationChanged`](#onAnnotationChanged) and [`onAnnotationFlattened`](#onAnnotationFlattened) are called. - -Parameters: - -Name | Type | Description ---- | --- | --- -action | string | the action that occurred (add, delete, modify) -annotations | array | array of annotation data in the format `{id: string, pageNumber: number, type: string}`, representing the annotations that have been changed. `type` is one of the [`Config.Tools`](./src/Config/Config.ts) constants - -```js - { - console.log('Annotation edit action is', action); - annotations.forEach(annotation => { - console.log('The id of changed annotation is', annotation.id); - console.log('It is in page', annotation.pageNumber); - console.log('Its type is', annotation.type); - }); - }} -/> -``` - -#### onAnnotationFlattened -function, optional - -This function is called if an annotation(s) has been flattened in the current document. - -Parameters: - -Name | Type | Description ---- | --- | --- -annotations | array | array of annotation data in the format `{id: string, pageNumber: number, type: string}`, representing the annotations that have been changed. `type` is one of the [`Config.Tools`](./src/Config/Config.ts) constants. `id`s returned via the event listener can be null. - -```js - { - annotations.forEach(annotation => { - console.log('The id of changed annotation is', annotation.id); - console.log('It is in page', annotation.pageNumber); - console.log('Its type is', annotation.type); - }); - }} -/> -``` - -#### onFormFieldValueChanged -function, optional - -This function is called if a change has been made to form field values. - -Parameters: - -Name | Type | Description ---- | --- | --- -fields | array | array of field data in the format `{fieldName: string, fieldType: string, fieldValue: any}`, representing the fields that have been changed - -```js - { - fields.forEach(field => { - console.log('The name of the changed field is', field.fieldName); - console.log('The type of the changed field is', field.fieldType); - console.log('The value of the changed field is', field.fieldValue); - }); - }} -/> -``` - -#### annotationsListEditingEnabled -bool, optional, Android only, default value is true - -If document editing is enabled, then this value determines if the annotation list is editable. - -Functionality for iOS will fixed in the next official release, or a fixed version is available by pointing the iOS podfile to https://nightly-pdftron.s3-us-west-2.amazonaws.com/stable/2021-06-30/9.0/cocoapods/pdfnet/2021-06-30_stable_rev77837.podspec as described in step one of the [iOS integration instructions](https://github.com/PDFTron/pdftron-react-native#ios). - - -```js - -``` - -#### disableEditingByAnnotationType -array of [`Config.Tools`](./src/Config/Config.ts) constants, optional, defaults to none. - -Defines annotation types that cannot be edited after creation. - -```js - -``` - -#### excludedAnnotationListTypes -array of [`Config.Tools`](./src/Config/Config.ts) constants, optional, defaults to none - -Defines types to be excluded from the annotation list. -Example use: - -```js - -``` - -### Bookmark - -#### onBookmarkChanged -function, optional - -This function is called if a change has been made to user bookmarks. - -Parameters: - -Name | Type | Description ---- | --- | --- -bookmarkJson | string | the list of current bookmarks in JSON format - -```js - { - console.log('Bookmarks have been changed. Current bookmark collection is', bookmarkJson); - }} -/> -``` - -#### userBookmarksListEditingEnabled -bool, optional, default value is true - -Defines whether the bookmark list can be edited. If the viewer is readonly then bookmarks on Android are -still editable but are saved to the device rather than the PDF. - -```js - -``` - -### Signature - -#### signSignatureFieldsWithStamps -bool, optional, defaults to false - -Defines whether signature fields will be signed with image stamps. -This is useful if you are saving XFDF to remote source. - -```js - -``` - -#### showSavedSignatures -bool, optional, defaults to true - -Defines whether to show saved signatures for re-use when using the signing tool. - -```js - -``` - -#### photoPickerEnabled -bool, optional, defaults to true. Android only. - -Defines whether to show the option to pick images in the signature dialog. - -```js - -``` - -### Thumbnail Browser - -#### hideThumbnailFilterModes -array of [`Config.ThumbnailFilterMode`](./src/Config/Config.ts) constants, optional - -Defines filter modes that should be hidden in the thumbnails browser. - -```js - -``` - -#### thumbnailViewEditingEnabled -bool, optional, defaults to true - -Defines whether user can modify the document using the thumbnail view (eg add/remove/rotate pages). - -```js - -``` - -### Text Selection - -#### onTextSearchStart -function, optional - -This function is called immediately before a text search begins, either through user actions, or function calls such as [`findText`](#findText). - -```js - { - console.log('Text search has started'); - }} -/> -``` - -#### onTextSearchResult -function, optional - -This function is called after a text search is finished or canceled. - -Parameters: - -Name | Type | Description ---- | --- | --- -found | bool | whether a result is found. If no, it could be caused by not finding a matching result in the document, invalid text input, or action cancellation (user actions or [`cancelFindText`](#cancelFindText)) -textSelection | object | the text selection, in the format `{html: string, unicode: string, pageNumber: number, quads: [[{x: number, y: number}, {x: number, y: number}, {x: number, y: number}, {x: number, y: number}], ...]}`. If no such selection could be found, this would be null - -quads indicate the quad boundary boxes for the selection, which could have a size larger than 1 if selection spans across different lines. Each quad have 4 points with x, y coordinates specified in number, representing a boundary box. The 4 points are in counter-clockwise order, though the first point is not guaranteed to be on lower-left relatively to the box. - -```js - { - if (found) { - console.log('Found selection on page', textSelection.pageNumber); - for (let i = 0; i < textSelection.quads.length; i ++) { - const quad = textSelection.quads[i]; - console.log('selection boundary quad', i); - for (const quadPoint of quad) { - console.log('A quad point has coordinates', quadPoint.x, quadPoint.y); - } - } - } - }} -/> -``` - -### Others - -#### useStylusAsPen -bool, optional, defaults to true - -Defines whether a stylus should act as a pen when in pan mode. If false, it will act as a finger. - -```js - -``` - -#### followSystemDarkMode -bool, optional, Android and iOS 13+ 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. - -```js - -``` - -#### autoSaveEnabled -bool, optional, defaults to true - -Defines whether document is automatically saved by the viewer. - -```js - -``` - -#### autoResizeFreeTextEnabled -bool, optional, defaults to false - -Defines whether to automatically resize the bounding box of free text annotations when editing. - -```js - -``` - -#### restrictDownloadUsage -bool, optional, defaults to false - -Defines whether to restrict data usage when viewing online PDFs. - -```js - -``` - -### Navigation - -#### pageStackEnabled -bool, optional, defaults to true, Android only - -Defines whether the page stack navigation buttons will appear in the viewer. - -```js - -``` - -#### showQuickNavigationButton -bool, optional, defaults to true - -Defines whether the quick navigation buttons will appear in the viewer. - -```js - -``` - -#### showNavigationListAsSidePanelOnLargeDevices -bool, optional, defaults to true on Android and false on iOS - -Defines whether the navigation list will be displayed as a side panel on large devices such as iPads and tablets. - -```js - -``` - -#### onUndoRedoStateChanged -function, optional - -This function is called when the state of the current document's undo/redo stack has been changed. - -```js - { - console.log("Undo/redo stack state changed"); - }} -/> -``` - -## DocumentView - Methods - -### Document - -#### getDocumentPath -Returns the path of the current document. If [`isBase64String`](#isBase64String) is true, this would be the path to the temporary pdf file converted from the base64 string in [`document`](#document). - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -path | string | the document path - -```js -this._viewer.getDocumentPath().then((path) => { - console.log('The path to current document is: ' + path); -}); -``` - -#### saveDocument -Saves the current document. If [`isBase64String`](#isBase64String) is true, this would be the base64 string encoded from the temporary pdf file, which is created from the base64 string in [`document`](#document). - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -filePath | string | the location of the saved document, or the base64 string of the pdf in the case of base64 - -```js -this._viewer.saveDocument().then((filePath) => { - console.log('saveDocument:', filePath); -}); -``` - -### UI Customization - -#### setColorPostProcessMode -Sets the color post processing transformation mode for the viewer. - -Parameters: - -Name | Type | Description ---- | --- | --- -colorPostProcessMode | string | color post processing transformation mode, should be a [`Config.ColorPostProcessMode`](./src/Config/Config.ts) constant - -```js -this._viewer.setColorPostProcessMode(Config.ColorPostProcessMode.NightMode); -``` - -#### setColorPostProcessColors -Sets the white and black color for the color post processing transformation. - -Parameters: - -Name | Type | Description ---- | --- | --- -whiteColor | object | the white color for the color post processing transformation, in the format `{red: number, green: number, blue: number}`. `alpha` could be optionally included (only Android would apply alpha), and all numbers should be in range [0, 255] -blackColor | object | the black color for the color post processing transformation, in the same format as whiteColor - -```js -const whiteColor = {"red": 0, "green": 0, "blue": 255}; -const blackColor = {"red": 255, "green": 0, "blue": 0}; -this._viewer.setColorPostProcessColors(whiteColor, blackColor); -``` - -### Annotation Tools - -#### setToolMode -Sets the current tool mode. - -Returns a Promise. - -Parameters: - -Name | Type | Description ---- | --- | --- -toolMode | string | One of [`Config.Tools`](./src/Config/Config.ts) constants, representing to tool mode to set - -```js -this._viewer.setToolMode(Config.Tools.annotationCreateFreeHand).then(() => { - // done switching tools -}); -``` - -#### commitTool -Commits the current tool, only available for multi-stroke ink and poly-shape. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -committed | bool | true if either ink or poly-shape tool is committed, false otherwise - -```js -this._viewer.commitTool().then((committed) => { - // committed: true if either ink or poly-shape tool is committed, false otherwise -}); -``` - -### Page - -#### getPageCount -Gets the current page count of the document. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -pageCount | int | the current page count of the document - -```js -this._viewer.getPageCount().then((pageCount) => { - console.log('pageCount', pageCount); -}); -``` - -#### setCurrentPage -Sets current page of the document. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageNumber | integer | the page number to be set as the current page; 1-indexed - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -success | bool | whether the setting process was successful - -```js -this._viewer.setCurrentPage(4).then((success) => { - if (success) { - console.log("Current page is set to 4."); - } -}); -``` - -#### gotoPreviousPage -Go to the previous page of the document. If on first page, it would stay on first page. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -success | bool | whether the setting process was successful (no change due to staying in first page counts as being successful) - -```js -this._viewer.gotoPreviousPage().then((success) => { - if (success) { - console.log("Go to previous page."); - } -}); -``` - -#### gotoNextPage -Go to the next page of the document. If on last page, it would stay on last page. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -success | bool | whether the setting process was successful (no change due to staying in last page counts as being successful) - -```js -this._viewer.gotoNextPage().then((success) => { - if (success) { - console.log("Go to next page."); - } -}); -``` - -#### gotoFirstPage -Go to the first page of the document. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -success | bool | whether the setting process was successful - -```js -this._viewer.gotoFirstPage().then((success) => { - if (success) { - console.log("Go to first page."); - } -}); -``` - -#### gotoLastPage -Go to the last page of the document. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -success | bool | whether the setting process was successful - -```js -this._viewer.gotoLastPage().then((success) => { - if (success) { - console.log("Go to last page."); - } -}); -``` - -#### showGoToPageView -Opens a go-to page dialog. If the user inputs a valid page number into the dialog, the viewer will go to that page. - -Returns a Promise. - -```js -this._viewer.showGoToPageView(); -``` - -#### getPageCropBox -Gets the crop box for specified page as a JSON object. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageNumber | integer | the page number for the target crop box. It is 1-indexed - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -cropBox | object | an object with information about position (`x1`, `y1`, `x2` and `y2`) and size (`width` and `height`) - -```js -this._viewer.getPageCropBox(1).then((cropBox) => { - console.log('bottom-left coordinate:', cropBox.x1, cropBox.y1); - console.log('top-right coordinate:', cropBox.x2, cropBox.y2); - console.log('width and height:', cropBox.width, cropBox.height); -}); -``` - -#### getVisiblePages -Gets the visible pages in the current viewer as an array. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -visiblePages | array | a list of visible pages in the current viewer - -```js -this._viewer.getVisiblePages().then((visiblePages) => { - for (const page of visiblePages) { - console.log('page', page, 'is visible.') - } -}); -``` - -#### getPageRotation -Gets the rotation value of all pages in the current document. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -pageRotation | number | the rotation degree of all pages, one of 0, 90, 180 or 270 (clockwise). - -```js -this._viewer.getPageRotation().then((pageRotation) => { - console.log('The current page rotation degree is' + pageRotation); -}); -``` - -#### rotateClockwise -Rotates all pages in the current document in clockwise direction (by 90 degrees). - -Returns a Promise. - -```js -this._viewer.rotateClockwise(); -``` - -#### rotateCounterClockwise -Rotates all pages in the current document in counter-clockwise direction (by 90 degrees). - -Returns a Promise. - -```js -this._viewer.rotateCounterClockwise(); -``` - -#### showRotateDialog -Displays a rotate dialog. Android only. - -The dialog allows users to rotate pages of the opened document by 90, 180 and 270 degrees. It also displays a thumbnail of the current page at the selected rotation angle. - -Returns a Promise. - -```js -this._viewer.showRotateDialog(); -``` - -### Import/Export Annotations - -#### importAnnotationCommand -Imports remote annotation command to local document. Can be used in both local and collaboration mode. - -Parameters: - -Name | Type | Description ---- | --- | --- -xfdfCommand | string | the XFDF command string -initialLoad | bool | whether this is for initial load. Will be false by default - -Returns a Promise. - -```js -const xfdfCommand = ''; -this._viewer.importAnnotationCommand(xfdfCommand); - -``` - -#### importAnnotations -Imports XFDF annotation string to the current document. - -`importAnnotations` should only be used in local mode. To import annotations in collaboration mode, use [`importAnnotationCommand`](#importAnnotationCommand). - -Parameters: - -Name | Type | Description ---- | --- | --- -xfdf | string | annotation string in XFDF format for import - -Returns a Promise. - -```js -const xfdf = '\n\n\t\n\t\t\n\t\n\t\t\n\t\n\t\n'; -this._viewer.importAnnotations(xfdf); -``` - -#### exportAnnotations -Extracts XFDF from the current document. - -Parameters: - -Name | Type | Description ---- | --- | --- -options | object | key: annotList, type: array. If specified, annotations with the matching id and pageNumber will be exported; otherwise, all annotations in the current document will be exported. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -xfdf | string | annotation string in XFDF format - -Without options: - -```js -this._viewer.exportAnnotations().then((xfdf) => { - console.log('XFDF for all annotations:', xfdf); -}); -``` - -With options: - -```js -// annotList is an array of annotation data in the format {id: string, pageNumber: int} -const annotations = [{id: 'annot1', pageNumber: 1}, {id: 'annot2', pageNumber: 3}]; -this._viewer.exportAnnotations({annotList: annotations}).then((xfdf) => { - console.log('XFDF for 2 specified annotations', xfdf); -}); -``` - -### 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 Promise. - -```js -// flatten forms and annotations in the current document. -this._viewer.flattenAnnotations(false); -``` - -#### deleteAnnotations -Deletes the specified annotations in the current document. - -Parameters: - -Name | Type | Description ---- | --- | --- -annotations | array | Defines which annotation to be deleted. Each element is in the format {id: string, pageNumber: int} - -Returns a Promise. - -```js -// delete annotations in the current document. -this._viewer.deleteAnnotations([ - { - id: 'annotId1', - pageNumber: 1, - }, - { - id: 'annotId2', - pageNumber: 2, - } -]); -``` - -#### selectAnnotation -Selects the specified annotation in the current document. - -Parameters: - -Name | Type | Description ---- | --- | --- -id | string | the id of the target annotation -pageNumber | integer | the page number where the targe annotation is located. It is 1-indexed - -Returns a Promise. - -```js -// select annotation in the current document. -this._viewer.selectAnnotation('annotId1', 1); -``` - -#### setFlagsForAnnotations -Sets flags for specified annotations in the current document. The `flagValue` controls whether a flag will be set to or removed from the annotation. - -Note: the old function `setFlagForAnnotations` is deprecated. Please use this one. - -Parameters: - -Name | Type | Description ---- | --- | --- -annotationFlagList | array | A list of annotation flag operations. Each element is in the format {id: string, pageNumber: int, flag: One of [`Config.AnnotationFlags`](./src/Config/Config.ts) constants, flagValue: bool} - -Returns a Promise. - -```js -// Set flag for annotations in the current document. -this._viewer.setFlagsForAnnotations([ - { - id: 'annotId1', - pageNumber: 1, - flag: Config.AnnotationFlags.noView, - flagValue: true - }, - { - id: 'annotId2', - pageNumber: 5, - flag: Config.AnnotationFlags.lockedContents, - flagValue: false - } -]); -``` - -#### setPropertiesForAnnotation -Sets properties for specified annotation in the current document, if it is valid. - -Note: the old function `setPropertyForAnnotation` is deprecated. Please use this one. - -Parameters: - -Name | Type | Description ---- | --- | --- -annotationId | string | the unique id of the annotation -pageNumber | integer | the page number where annotation is located. It is 1-indexed -propertyMap | object | an object containing properties to be set. Available properties are listed below - -Properties in propertyMap: - -Name | Type | Markup exclusive | Example ---- | --- | --- | --- -rect | object | no | {x1: 1, y1: 2, x2: 3, y2: 4} -contents | string | no | "contents" -subject | string | yes | "subject" -title | string | yes | "title" -contentRect | object | yes | {x1: 1, y1: 2, x2: 3, y2: 4} -customData | object | no | {key: value} -strokeColor | object | no | {red: 255, green: 0, blue: 0} - -Returns a promise. - -```js -// Set properties for annotation in the current document. -this._viewer.setPropertiesForAnnotation('Pdftron', 1, { - rect: { - x1: 1.1, // left - y1: 3, // bottom - x2: 100.9, // right - y2: 99.8 // top - }, - contents: 'Hello World', - subject: 'Sample', - title: 'set-prop-for-annot', - customData: { - key1: 'value1', - key2: 'value2', - key3: 'value3' - }, - strokeColor: { - "red": 255, - "green": 0, - "blue": 0 - } -}); -``` - -#### getPropertiesForAnnotation -Gets properties for specified annotation in the current document, if it is valid. - -Parameters: - -Name | Type | Description ---- | --- | --- -annotationId | string | the unique id of the annotation -pageNumber | integer | the page number where annotation is located. It is 1-indexed - -Available Properties: - -Name | Type | Markup exclusive | Example ---- | --- | --- | --- -rect | object | no | {x1: 1, y1: 1, x2: 2, y2: 2, width: 1, height: 1} -contents | string | no | "Contents" -subject | string | yes | "Subject" -title | string | yes | "Title" -contentRect | object | yes | {x1: 1, y1: 1, x2: 2, y2: 2, width: 1, height: 1} -strokeColor | object | no | {red: 255, green: 0, blue: 0} - -Returns a promise. - -Promise Parameters: - -Name | Type | Description | Example ---- | --- | --- | --- -propertyMap | object | the non-null properties of the annotation | `{contents: 'Contents', strokeColor: {red: 255, green: 0, blue: 0}, rect: {x1: 1, y1: 1, x2: 2, y2: 2, width: 1, height: 1}}` - -```js -// Get properties for annotation in the current document. -this._viewer.getPropertiesForAnnotation('Pdftron', 1).then((properties) => { - if (properties) { - console.log('Properties for annotation: ', properties); - } -}) -``` - -#### setDrawAnnotations -Sets whether all annotations and forms should be rendered. This method affects the viewer and does not change the document. - -Unlike [setVisibilityForAnnotation](#setVisibilityForAnnotation), this method is used to show and hide all annotations and forms in the viewer. - -Parameters: - -Name | Type | Description ---- | --- | --- -drawAnnotations | bool | whether all annotations and forms should be rendered - -Returns a promise. - -```js -this._viewer.setDrawAnnotations(false); -``` - -#### setVisibilityForAnnotation -Sets visibility for specified annotation in the current document, if it is valid. Note that if [`drawAnnotations`](#drawAnnotations) is set to false in the viewer, this function would not render the annotation even if visibility is true. - -Parameters: - -Name | Type | Description ---- | --- | --- -annotationId | string | the unique id of the annotation -pageNumber | integer | the page number where annotation is located. It is 1-indexed -visibility | bool | whether the annotation should be visible - -Returns a promise. - -```js -this._viewer.setVisibilityForAnnotation('Pdftron', 1, true); -``` - -#### setHighlightFields -Enables or disables highlighting form fields. It is disabled by default. - -Parameters: - -Name | Type | Description ---- | --- | --- -highlightFields | bool | whether form fields should be highlighted - -```js -this._viewer.setHighlightFields(true); -``` - - -#### getAnnotationAtPoint -Gets an annotation at the (x, y) position in screen coordinates, if any. - -Parameters: - -Name | Type | Description ---- | --- | --- -x | integer | the x-coordinate of the point -y | integer | the y-coordinate of the point -distanceThreshold | double | maximum distance from the point (x, y) to the annotation for it to be considered a hit (in dp) -minimumLineWeight | double | For very thin lines, it is almost impossible to hit the actual line. This specifies a minimum line thickness (in screen coordinates) for the purpose of calculating whether a point is inside the annotation or not (in dp) - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -annotation | object | the annotation found in the format of `{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`. `type` is one of the [`Config.Tools`](./src/Config/Config.ts) constants. `screenRect` was formerly called `rect`. - -```js -this._viewer.getAnnotationAtPoint(167, 287, 100, 10).then((annotation) => { - if (annotation) { - console.log('Annotation found at point (167, 287) has id:', annotation.id); - } -}) -``` - -#### getAnnotationListAt -Gets the list of annotations at a given line in screen coordinates. Note that this is not an area selection. It should be used similar to [`getAnnotationAtPoint`](#getAnnotationAtPoint), except that this should be used when you want to get multiple annotations which are overlaying with each other. - -Parameters: - -Name | Type | Description ---- | --- | --- -x1 | integer | the x-coordinate of an endpoint on the line -y1 | integer | the y-coordinate of an endpoint on the line -x2 | integer | the x-coordinate of the other endpoint on the line, usually used as a threshold -y2 | integer | the y-coordinate of the other endpoint on the line, usually used as a threshold - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -annotations | array | list of annotations at the target line, each in the format of `{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`. `type` is one of the [`Config.Tools`](./src/Config/Config.ts) constants. `screenRect` was formerly called `rect`. - -```js -this._viewer.getAnnotationListAt(0, 0, 200, 200).then((annotations) => { - for (const annotation of annotations) { - console.log('Annotation found at line has id:', annotation.id); - } -}) -``` - -#### getAnnotationsOnPage -Gets the list of annotations on a given page. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageNumber | integer | the page number where annotations are located. It is 1-indexed - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -annotations | array | list of annotations on the target page, each in the format of `{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`. `type` is one of the [`Config.Tools`](./src/Config/Config.ts) constants. `screenRect` was formerly called `rect`. - -```js -this._viewer.getAnnotationsOnPage(2).then((annotations) => { - for (const annotation of annotations) { - console.log('Annotation found on page 2 has id:', annotation.id); - } -}) -``` - -#### getCustomDataForAnnotation -Gets an annotation's `customData` property. - -Parameters: - -Name | Type | Description ---- | --- | --- -annotationId | string | the unique id of the annotation -pageNumber | integer | the page number where annotation is located. It is 1-indexed -key | string | the unique key associated with the `customData` property - -Returns a Promise. - -Promise Parameters: -Name | Type | Description ---- | --- | --- -value | string | the `customData` property associated with the given key - -```js -this._viewer.setPropertiesForAnnotation("annotation1", 2, { - customData: { - data: "Nice annotation" - } -}).then(() => { - this._viewer.getCustomDataForAnnotation("annotation1", 2, "data").then((value) => { - console.log(value === "Nice annotation"); - }) -}) -``` - -#### setFlagForFields -Sets a field flag value on one or more form fields. - -Parameters: - -Name | Type | Description ---- | --- | --- -fields | array | list of field names for which the flag should be set -flag | int | flag to be set. Number should be a [`Config.FieldFlags`](./src/Config/Config.ts) constant -value | bool | value to set for flag - -Returns a Promise. - -```js -this._viewer.setFlagForFields(['First Name', 'Last Name'], Config.FieldFlags.ReadOnly, true); -``` - -#### setValuesForFields -Sets field values on one or more form fields. - -Note: the old function `setValueForFields` is deprecated. Please use this one instead. - -Parameters: - -Name | Type | Description ---- | --- | --- -fieldsMap | object | map of field names and values which should be set - -Returns a Promise. - -```js -this._viewer.setValuesForFields({ - 'textField1': 'Test', - 'textField2': 1234, - 'checkboxField1': true, - 'checkboxField2': false, - 'radioButton1': 'Yes', - 'radioButton2': 'No' -}); -``` - -#### getField -Get type and value information of a field using its name. - -Parameters: - -Name | Type | Description ---- | --- | --- -fieldName | string | name of the field - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -field | object | an object with information key `fieldName`, `fieldValue` (undefined for fields with no values) and `fieldType`(one of button, checkbox, radio, text, choice, signature and unknown), or undefined if such field does not exist - -```js -this._viewer.getField('someFieldName').then((field) => { - if (field !== undefined) { - console.log('field name:', field.fieldName); - console.log('field value:', field.fieldValue); - console.log('field type:', field.fieldType); - } -}); -``` - -#### openAnnotationList -Displays the annotation tab of the existing list container. If this tab has been disabled, the method does nothing. - -Returns a Promise. - -```js -this._viewer.openAnnotationList(); -``` - -#### openThumbnailsView -Display a page thumbnails view. - -This view allows users to navigate pages of a document. If [`thumbnailViewEditingEnabled`](#thumbnailViewEditingEnabled) is true, the user can also manipulate the document, including add, remove, re-arrange, rotate and duplicate pages. - -Returns a Promise. - -```js -this._viewer.openThumbnailsView(); -``` - -### Toolbar - -#### setCurrentToolbar -Sets the current [`annotationToolbar`](#annotationToolbars) for the viewer. - -Returns a Promise. - -Parameters: - -Name | Type | Description ---- | --- | --- -toolbar | string | the toolbar to enable. Should be one of the [`Config.DefaultToolbars`](./src/Config/Config.ts) constants or the `id` of a custom toolbar object. - -```js -this._viewer.setCurrentToolbar(Config.DefaultToolbars.Insert).then(() => { - // done switching toolbar -}); -``` - -### Navigation - -#### handleBackButton -Handles the back button in search mode. Android only. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -handled | bool | whether the back button is handled successfully - -```js -this._viewer.handleBackButton().then((handled) => { - if (!handled) { - BackHandler.exitApp(); - } -}); -``` - -### Bookmark - -#### importBookmarkJson -Imports user bookmarks into the document. The input needs to be a valid bookmark JSON format. - -Parameters: - -Name | Type | Description ---- | --- | --- -bookmarkJson | String | needs to be in valid bookmark JSON format, for example {"0": "Page 1"}. The page numbers are 1-indexed - -Returns a Promise. - -```js -this._viewer.importBookmarkJson("{\"0\": \"Page 1\", \"3\": \"Page 4\"}"); -``` - -#### openBookmarkList -Displays the bookmark tab of the existing list container. If this tab has been disabled, the method does nothing. - -Returns a Promise. - -```js -this._viewer.openBookmarkList(); -``` - -### Multi-tab - -#### closeAllTabs -Closes all tabs in a multi-tab environment. - -Returns a Promise. - -```js -// Do this only when DocumentView has multiTabEnabled = true -this._viewer.closeAllTabs(); -``` - -#### openTabSwitcher -Opens the tab switcher in a multi-tab environment. - -Returns a Promise. - -```js -// Do this only when DocumentView has multiTabEnabled = true -this._viewer.openTabSwitcher(); -``` - -### Zoom - -#### getZoom -Returns the current zoom scale of current document viewer. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -zoom | double | current zoom scale in the viewer - -```js -this._viewer.getZoom().then((zoom) => { - console.log('Zoom scale of the current document is:', zoom); -}); -``` - -#### setZoomLimits -Sets the minimum and maximum zoom bounds of current viewer. - -Parameters: - -Name | Type | Description ---- | --- | --- -zoomLimitMode | String | one of the constants in [`Config.ZoomLimitMode`](./src/Config/Config.ts), defines whether bounds are relative to the standard zoom scale in the current viewer or absolute -minimum | double | the lower bound of the zoom limit range -maximum | double | the upper bound of the zoom limit range - -Returns a Promise. - -```js -this._viewer.setZoomLimits(Config.ZoomLimitMode.Absolute, 1.0, 3.5); -``` - -#### zoomWithCenter -Sets the zoom scale in the current document viewer with a zoom center. - -Parameters: - -Name | Type | Description ---- | --- | --- -zoom | double | the zoom ratio to be set -x | int | the x-coordinate of the zoom center -y | int | the y-coordinate of the zoom center - -Returns a Promise. - -```js -this._viewer.zoomWithCenter(3.0, 100, 300); -``` - -#### zoomToRect -Zoom the viewer to a specific rectangular area in a page. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageNumber | int | the page number of the zooming area (1-indexed) -rect | map | The rectangular area with keys x1 (left), y1(bottom), y1(right), y2(top). Coordinates are in double - -Returns a Promise. - -```js -this._viewer.zoomToRect(3, {'x1': 1.0, 'y1': 2.0, 'x2': 3.0, 'y2': 4.0}); -``` - -#### smartZoom -Zoom to a paragraph that contains the specified coordinate. If no paragraph contains the coordinate, the zooming would not happen. - -Parameters: - -Name | Type | Description --- | -- | -- -x | int | the x-coordinate of the target coordinate -y | int | the y-coordinate of the target coordinate -animated | bool | whether the transition is animated - -Returns a Promise. - -```js -this._viewer.smartZoom(100, 200, true); -``` - -### Scroll - -#### getScrollPos -Returns the horizontal and vertical scroll position of current document viewer. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -horizontal | number | current horizontal scroll position -vertical | number | current vertical scroll position - -```js -this._viewer.getScrollPos().then(({horizontal, vertical}) => { - console.log('Current horizontal scroll position is:', horizontal); - console.log('Current vertical scroll position is:', vertical); -}); -``` - -### Reflow - -#### isReflowMode -Returns whether the viewer is currently in reflow mode. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -inReflow | bool | whether the viewer is in reflow mode - -```js -this._viewer.isReflowMode().then((inReflow) => { - console.log(inReflow ? 'in reflow mode' : 'not in reflow mode'); -}); -``` - -#### toggleReflow -Allows the user to programmatically enter and exit reflow mode. - -Returns a promise. - -```js -this._viewer.toggleReflow(); -``` - -### Canvas - -#### getCanvasSize -Returns the canvas size of current document viewer. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -width | number | current width of canvas -height | number | current height of canvas - -```js -this._viewer.getCanvasSize().then(({width, height}) => { - console.log('Current canvas width is:', width); - console.log('Current canvas height is:', height); -}); -``` - -### Coordinate - -#### convertPagePointsToScreenPoints -Converts points from page coordinates to screen coordinates in the viewer. - -Parameters: - -Name | Type | Description ---- | --- | --- -points | array | list of points, each in the format `{x: number, y: number}`. You could optionally have a `pageNumber: number` in the object. Without specifying, the page system is referring to the current page - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -convertedPoints | array | list of converted points in screen system, each in the format `{x: number, y: number}`. It would be empty if conversion is unsuccessful - -```js -// convert (50, 50) on current page and (100, 100) on page 1 from page system to screen system -this._viewer.convertPagePointsToScreenPoints([{x: 50, y: 50}, {x: 100, y:100, pageNumber: 1}]).then((convertedPoints) => { - convertedPoints.forEach(point => { - console.log(point); - }) -}); -``` - -#### convertScreenPointsToPagePoints -Converts points from screen coordinates to page coordinates in the viewer. - -Parameters: - -Name | Type | Description ---- | --- | --- -points | array | list of points, each in the format `{x: number, y: number}`. You could optionally have a `pageNumber: number` in the object. Without specifying, the page system is referring to the current page - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -convertedPoints | array | list of converted points in page system, each in the format `{x: number, y: number}`. It would be empty if conversion is unsuccessful - -```js -// convert (50, 50) and (100, 100) from screen system to page system, on current page and page 1 respectively -this._viewer.convertScreenPointsToPagePoints([{x: 50, y: 50}, {x: 100, y:100, pageNumber: 1}]).then((convertedPoints) => { - convertedPoints.forEach(point => { - console.log(point); - }) -}); -``` - -#### getPageNumberFromScreenPoint -Returns the page number that contains the point on screen. - -Parameters: - -Name | Type | Description ---- | --- | --- -x | number | the x-coordinate of the screen point -y | number | the y-coordinate of the screen point - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -pageNumber | number | the page number of the screen point - -```js -this._viewer.getPageNumberFromScreenPoint(10.0,50.5).then((pageNumber) => { - console.log('The page number of the screen point is', pageNumber); -}); -``` - -### Rendering Options - -#### setProgressiveRendering -Sets whether the control will render progressively or will just draw once the entire view has been rendered. - -Parameters: - -Name | Type | Description ---- | --- | --- -progressiveRendering | bool | whether to render progressively -initialDelay | number | delay before the progressive rendering timer is started, in milliseconds -interval | number | delay between refreshes, in milliseconds - -Returns a Promise. - -```js -// delay for 10s before start, and refresh every 1s -this._viewer.setProgressiveRendering(true, 10000, 1000); -``` - -#### setImageSmoothing -Enables or disables image smoothing. The rasterizer allows a trade-off between rendering quality and rendering speed. This function can be used to indicate the preference between rendering speed and quality. - -Parameters: - -Name | Type | Description ---- | --- | --- -imageSmoothing | bool | whether to enable image smoothing - -Returns a Promise. - -```js -this._viewer.setImageSmoothing(false); -``` - -#### setOverprint -Enables or disables support for overprint and overprint simulation. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). - -Parameters: - -Name | Type | Description ---- | --- | --- -overprint | string | the mode of overprint, should be a [`Config.OverprintMode`](./src/Config/Config.ts) constant - -Returns a Promise. - -```js -this._viewer.setOverprint(Config.OverprintMode.Off); -``` - -### Viewer Options - -#### setPageBorderVisibility -Sets whether borders of each page are visible in the viewer, which is disabled by default. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageBorderVisibility | bool | whether borders of each page are visible in the viewer - -```js -this._viewer.setPageBorderVisibility(true); -``` - -#### setPageTransparencyGrid -Enables or disables transparency grid (check board pattern) to reflect page transparency, which is disabled by default. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageTransparencyGrid | bool | whether to use the transparency grid - -```js -this._viewer.setPageTransparencyGrid(true); -``` - -#### setBackgroundColor -Sets the background color of the viewer. - -Parameters: - -Name | Type | Description ---- | --- | --- -backgroundColor | object | the background color, in the format `{red: number, green: number, blue: number}`, each number in range [0, 255] - -```js -this._viewer.setBackgroundColor({red: 0, green: 0, blue: 255}); // blue color -``` - -#### setDefaultPageColor -Sets the default page color of the viewer. - -Parameters: - -Name | Type | Description ---- | --- | --- -defaultPageColor | object | the default page color, in the format `{red: number, green: number, blue: number}`, each number in range [0, 255] - -```js -this._viewer.setDefaultPageColor({red: 0, green: 255, blue: 0}); // green color -``` - -### Text Selection - -#### startSearchMode -Search for a term and all matching results will be highlighted. - -Returns a Promise. - -Parameters: - -Name | Type | Description ---- | --- | --- -searchString | string | the text to search for -matchCase | bool | indicates if it is case sensitive -matchWholeWord | bool | indicates if it matches an entire word only - -```js -this._viewer.startSearchMode('PDFTron', false, false); -``` - -#### exitSearchMode -Finishes the current text search and remove all the highlights. - -Returns a Promise. - -```js -this._viewer.exitSearchMode(); -``` - -#### findText -Searches asynchronously, starting from the current page, for the given text. PDFViewCtrl automatically scrolls to the position so that the found text is visible. - -Returns a Promise. - -Parameters: - -Name | Type | Description ---- | --- | --- -searchString | string | the text to search for -matchCase | bool | indicates if it is case sensitive -matchWholeWord | bool | indicates if it matches an entire word only -searchUp | bool | indicates if it searches upward -regExp | bool | indicates if searchString is a regular expression - -```js -this._viewer.findText('PDFTron', false, false, true, false); -``` - -#### cancelFindText -Cancels the current text search thread, if exists. - -Returns a Promise. - -```js -this._viewer.cancelFindText(); -``` - -#### openSearch -Displays a search bar that allows the user to enter and search text within a document. - -Returns a Promise. - -```js -this._viewer.openSearch(); -``` - -#### getSelection -Returns the text selection on a given page, if any. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageNumber | number | the specified page number. It is 1-indexed - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -selection | object | the text selection, in the format `{html: string, unicode: string, pageNumber: number, quads: [[{x: number, y: number}, {x: number, y: number}, {x: number, y: number}, {x: number, y: number}], ...]}`. If no such selection could be found, this would be null - -quads indicate the quad boundary boxes for the selection, which could have a size larger than 1 if selection spans across different lines. Each quad have 4 points with x, y coordinates specified in number, representing a boundary box. The 4 points are in counter-clockwise order, though the first point is not guaranteed to be on lower-left relatively to the box. - -```js -this._viewer.getSelection(2).then((selection) => { - if (selection) { - console.log('Found selection on page', selection.pageNumber); - for (let i = 0; i < selection.quads.length; i ++) { - const quad = selection.quads[i]; - console.log('selection boundary quad', i); - for (const quadPoint of quad) { - console.log('A quad point has coordinates', quadPoint.x, quadPoint.y); - } - } - } -}); -``` - -#### hasSelection -Returns whether there is a text selection in the current document. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -hasSelection | bool | whether a text selection exists - -```js -this._viewer.hasSelection().then((hasSelection) => { - console.log('There is a selection in the document.'); -}); -``` - -#### clearSelection -Clears any text selection in the current document. - -Returns a Promise. - -```js -this._viewer.clearSelection(); -``` - -#### getSelectionPageRange -Returns the page range (beginning and end) that has text selection on it. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -begin | number | the first page to have selection, -1 if there are no selections -end | number | the last page to have selection, -1 if there are no selections - -```js -this._viewer.getSelectionPageRange().then(({begin, end}) => { - if (begin === -1) { - console.log('There is no selection'); - } else { - console.log('The selection range is from', begin, 'to', end); - } -}); -``` - -#### hasSelectionOnPage -Returns whether there is a text selection on the specified page in the current document. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageNumber | number | the specified page number. It is 1-indexed - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -hasSelection | bool | whether a text selection exists on the specified page - -```js -this._viewer.hasSelectionOnPage(5).then((hasSelection) => { - if (hasSelection) { - console.log('There is a selection on page 5 in the document.'); - } -}); -``` - -#### selectInRect -Selects the text within the given rectangle region. - -Parameters: - -Name | Type | Description ---- | --- | --- -rect | object | the rectangle region in the format of `x1: number, x2: number, y1: number, y2: number` - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -selected | bool | whether there is text selected - -```js -this._viewer.selectInRect({x1: 0, y1: 0, x2: 200.5, y2: 200.5}).then((selected) => { - console.log(selected); -}); -``` - -#### isThereTextInRect -Returns whether there is text in given rectangle region. - -Parameters: - -Name | Type | Description ---- | --- | --- -rect | object | the rectangle region in the format of `x1: number, x2: number, y1: number, y2: number` - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -hasText | bool | whether there is text in the region - -```js -this._viewer.isThereTextInRect({x1: 0, y1: 0, x2: 200, y2: 200}).then((hasText) => { - console.log(hasText); -}); -``` - -#### selectAll -Selects all text on the page. - -Returns a Promise. - -```js -this._viewer.selectAll(); -``` - -### Undo/Redo - -#### undo -Undo the last modification. - -Returns a Promise. - -```js -this._viewer.undo(); -``` - -#### redo -Redo the last modification. - -Returns a Promise. - -```js -this._viewer.redo(); -``` - -#### canUndo -Checks whether an undo operation can be performed from the current snapshot. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -canUndo | bool | whether it is possible to undo from the current snapshot - -```js -this._viewer.canUndo().then((canUndo) => { - console.log(canUndo ? 'undo possible' : 'no action to undo'); -}); -``` - -#### canRedo -Checks whether a redo operation can be perfromed from the current snapshot. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -canRedo | bool | whether it is possible to redo from the current snapshot - -```js -this._viewer.canRedo().then((canRedo) => { - console.log(canRedo ? 'redo possible' : 'no action to redo'); -}); -``` - -### Signatures - -#### getSavedSignatures -Gets a list of absolute file paths to PDFs containing the saved signatures. - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -signatures | array | an array of string containing the absolute file paths; if there are no saved signatures, the value is an empty array - -```js -this._viewer.getSavedSignatures().then((signatures) => { - if (signatures.length > 0) { - signatures.forEach((signature) => { - console.log(signature); - }); - } -}) -``` - -#### getSavedSignatureFolder -Retrieves the absolute file path to the folder containing the saved signature PDFs. - -For Android, to get the folder containing the saved signature JPGs, use [`getSavedSignatureJpgFolder`](#getSavedSignatureJpgFolder). - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -path | string | the absolute file path to the folder - -```js -this._viewer.getSavedSignatureFolder().then((path) => { - if (path != null) { - console.log(path); - } -}) -``` - -#### getSavedSignatureJpgFolder -Retrieves the absolute file path to the folder containing the saved signature JPGs. Android only. - -To get the folder containing the saved signature PDFs, use [`getSavedSignatureFolder`](#getSavedSignatureFolder). - -Returns a Promise. - -Promise Parameters: - -Name | Type | Description ---- | --- | --- -path | string | the absolute file path to the folder - -```js -this._viewer.getSavedSignatureJpgFolder().then((path) => { - if (path != null) { - console.log(path); - } -}) -``` - -### Others - -#### exportAsImage -Export a PDF page to an image format defined in [`Config.ExportFormat`](./src/Config/Config.ts). - -Unlike RNPdftron.exportAsImage, this is a viewer method and should only be called *after* the document has been loaded or else unexpected behaviour can occur. This method uses the PDF that is associated with the viewer, and does not take a local file path to the desired PDF. - -Parameters: - -Name | Type | Description ---- | --- | --- -pageNumber | int | the page to be converted; if the value does not refer to a valid page number, the file path will be undefined -dpi | double | the output image resolution -exportFormat | string | one of the [`Config.ExportFormat`](./src/Config/Config.ts) constants - -Returns a Promise. - -Name | Type | Description ---- | --- | --- -path | string | the temp path of the created image, user is responsible for clean up the cache - -```js -this._viewer.exportToImage(1, 92, Config.ExportFormat.BMP).then((path) => { - console.log('export', path); -}); -``` - -#### showCrop -Displays the page crop option. Android only. - -Returns a Promise. - -```js -this._viewer.showCrop(); -``` - -#### openOutlineList -Displays the outline tab of the existing list container. If this tab has been disabled, the method does nothing. - -Returns a Promise. - -```js -this._viewer.openOutlineList(); -``` - -#### 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 a Promise. - -```js -this._viewer.openLayersList(); -``` - -#### openNavigationLists -Displays the existing list container. Its current tab will be the one last opened. - -Returns a Promise. - -```js -this._viewer.openNavigationLists(); -``` - -#### showViewSettings -Displays the view settings. - -Requires a source rect in screen co-ordinates. On iOS this rect will be the anchor point for the view. The rect is ignored on Android. - -Returns a Promise. - -Parameters: - -Name | Type | Description ---- | --- | --- -rect | map | The rectangular area in screen co-ordinates with keys x1 (left), y1(bottom), y1(right), y2(top). Coordinates are in double format. - -```js -this._viewer.showViewSettings({'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0}); -``` - -#### showAddPagesView -Displays the add pages view. - -Requires a source rect in screen co-ordinates. On iOS this rect will be the anchor point for the view. The rect is ignored on Android. - -Returns a Promise. - -Parameters: - -Name | Type | Description ---- | --- | --- -rect | map | The rectangular area in screen co-ordinates with keys x1 (left), y1(bottom), y1(right), y2(top). Coordinates are in double format. - -```js -this._viewer.showAddPagesView({'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0}); -``` - -#### shareCopy -Displays the share copy view. - -Requires a source rect in screen co-ordinates. On iOS this rect will be the anchor point for the view. The rect is ignored on Android. - -Returns a Promise. - -Parameters: - -Name | Type | Description ---- | --- | --- -rect | map | The rectangular area in screen co-ordinates with keys x1 (left), y1(bottom), y1(right), y2(top). Coordinates are in double format. -flattening | bool | Whether the shared copy should be flattened before sharing. - -```js -this._viewer.shareCopy({'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0}, true); -``` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21adf0404..57a7b4648 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,10 +8,12 @@ ## Pull requests 1. Fork the repository. -2. Create a branch from `dev`. +2. Create a branch from `master`. 3. Update the source code (in `*.ts` files). 4. Commit and push the changes with descriptive messages. -5. Create a pull request to `dev`. +4. Create a pull request to `master`. -\* Please note that all pull requests should be tied to an issue, and all but the most trivial pull requests should be discussed beforehand. -\*\* Changes made to `dev` will automatically be applied to `master`. For more detailed information on developing post-TypeScript migration, see the [wiki](https://github.com/PDFTron/pdftron-react-native/wiki). \ No newline at end of file +Please note: +- All pull requests should be tied to an issue, and all but the most trivial pull requests should be discussed beforehand. +- Every PR needs 1 approving review to be merged into `master` (unless you are an administrator of the repo). +- When PRs are made from a fork, the GitHub Actions script that updates and commits JS files will not succeed due to safety reasons. Instead, the JS files will have to be updated manually. \ No newline at end of file diff --git a/DocHome.md b/DocHome.md new file mode 100644 index 000000000..11e0df920 --- /dev/null +++ b/DocHome.md @@ -0,0 +1,25 @@ +# PDFTron React Native API + +PDFTron's React Native PDF Library allows applications to use JavaScript to build cross-platform mobile apps. + +The application UI is rendered using native views to provide users the fluid look and feel of traditional native applications. + +## TypeScript + +Starting with version 3.0.0, PDFTron React Native provides support for TypeScript! + +For TypeScript users, type information is automatically provided while coding. Exact type aliases and constants used in our custom typings can also be found in our [TypeScript source files](https://github.com/PDFTron/pdftron-react-native/tree/master/src). + +The typings used in these API docs will be described using normal JavaScript types. + +## Frequently used + +- {@link Config} - Defines configuration constants for the viewer. +- {@link DocumentView} - An all-in-one React component for displaying and editing documents of different types. +- {@link RNPdftron} - Contains static methods for global library initialization, configuration, and utility methods. + +## Links + +For instantiation, information, and source code, see our [GitHub](https://github.com/PDFTron/pdftron-react-native). + +For guides and support, visit us at the [PDFTron website](https://www.pdftron.com/documentation/guides/react-native/). \ No newline at end of file diff --git a/README.md b/README.md index 93be98c1c..171ee1788 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PDFTron React Native Wrapper -- [API](API.md) +- [API](https://raw.githack.com/PDFTron/pdftron-react-native/ts-typedocs-master/docs/index.html) - [Prerequisites](#prerequisites) - [Preview](#preview) - [Installation](#installation) @@ -10,7 +10,7 @@ - [License](#license) ## API -APIs are available on the [API page](API.md). +APIs are available on the [API page](https://raw.githack.com/PDFTron/pdftron-react-native/ts-typedocs-master/docs/index.html). ## Prerequisites - No license key is required for trial. However, a valid commercial license key is required after trial. @@ -336,7 +336,7 @@ To get access to TypeScript support, simply update your PDFTron React Native dep For non-TypeScript users, updating your PDFTron React Native dependency to version 3.0.0 or higher will not automatically install TypeScript itself, and you can continue to use the library as before (without TypeScript support). If you currently do not use TypeScript itself in your project and would like to, see [Adding TypeScript to an Existing Project](https://reactnative.dev/docs/typescript#adding-typescript-to-an-existing-project). Regardless of whether you use TypeScript, the following benefits are available: -- Proper API typings which can be used in tools such as [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense). This offers insight into the data being passed without referring to the [API documentation](API.md). +- Proper API typings which can be used in tools such as [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense). This offers insight into the data being passed without referring to the [API documentation](https://raw.githack.com/PDFTron/pdftron-react-native/ts-typedocs-master/docs/index.html). - Greater type safety and reliability due to the migration of source files from JavaScript to TypeScript. - Updated Add an API guides for [Android](https://www.pdftron.com/documentation/android/get-started/react-native/add-an-api/) and [iOS](https://www.pdftron.com/documentation/ios/get-started/react-native/add-an-api) to offer step-by-step, TypeScript-supported examples on accessing properties, methods, and events. Contributors should be aware that PRs must now be made to the `dev` branch (see [Contributing](./CONTRIBUTING.md)). diff --git a/android/build.gradle b/android/build.gradle index 74d8ee0e2..f8c540328 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -23,12 +23,12 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { - compileSdkVersion 29 + compileSdkVersion 30 buildToolsVersion "29.0.2" defaultConfig { minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 1 versionName "1.0" vectorDrawables.useSupportLibrary = true @@ -55,7 +55,7 @@ repositories { dependencies { implementation "com.facebook.react:react-native:+" - implementation "com.pdftron:pdftron:9.1.2-beta07" - implementation "com.pdftron:tools:9.1.2-beta07" - implementation "com.pdftron:collab:9.1.2-beta07" + implementation "com.pdftron:pdftron:9.1.2-beta10" + implementation "com.pdftron:tools:9.1.2-beta10" + implementation "com.pdftron:collab:9.1.2-beta10" } diff --git a/android/src/main/java/com/pdftron/reactnative/viewmanagers/DocumentViewViewManager.java b/android/src/main/java/com/pdftron/reactnative/viewmanagers/DocumentViewViewManager.java index 0820bf645..c8323ec2a 100644 --- a/android/src/main/java/com/pdftron/reactnative/viewmanagers/DocumentViewViewManager.java +++ b/android/src/main/java/com/pdftron/reactnative/viewmanagers/DocumentViewViewManager.java @@ -74,6 +74,11 @@ public void setShowNavButton(DocumentView documentView, boolean show) { documentView.setShowNavIcon(show); } + @ReactProp(name = "overflowMenuButtonIcon") + public void setOverflowMenuButtonIcon(DocumentView documentView, @NonNull String resName) { + documentView.setOverflowResName(resName); + } + @ReactProp(name = "disabledElements") public void setDisabledElements(DocumentView documentView, @NonNull ReadableArray array) { documentView.setDisabledElements(array); diff --git a/android/src/main/java/com/pdftron/reactnative/views/DocumentView.java b/android/src/main/java/com/pdftron/reactnative/views/DocumentView.java index 1745ca748..c197bad47 100644 --- a/android/src/main/java/com/pdftron/reactnative/views/DocumentView.java +++ b/android/src/main/java/com/pdftron/reactnative/views/DocumentView.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.util.AttributeSet; @@ -156,6 +157,9 @@ public class DocumentView extends com.pdftron.pdf.controls.DocumentView2 { private boolean mShowAddPageToolbarButton = true; + // overflow menu icon + private String mOverflowResName = null; + private ArrayList mViewModePickerItems = new ArrayList<>(); public DocumentView(Context context) { @@ -279,6 +283,10 @@ public void setNavResName(String resName) { } } + public void setOverflowResName(String resName) { + mOverflowResName = resName; + } + public void setDisabledElements(ReadableArray array) { disableElements(array); } @@ -881,7 +889,7 @@ public void setPageStackEnabled(boolean pageStackEnabled) { } public void setShowQuickNavigationButton(boolean showQuickNavigationButton) { - mBuilder = mBuilder.showQuickNavigationButton(showQuickNavigationButton); + mBuilder = mBuilder.pageStackEnabled(showQuickNavigationButton); } public void setPhotoPickerEnabled(boolean photoPickerEnabled) { @@ -2623,6 +2631,14 @@ public void onTabDocumentLoaded(String tag) { getToolManager().setReadOnly(true); } + if (mOverflowResName != null && mPdfViewCtrlTabHostFragment != null && mPdfViewCtrlTabHostFragment.getToolbar() != null) { + int res = Utils.getResourceDrawable(this.getContext(), mOverflowResName); + if (res != 0) { + Drawable icon = Utils.getDrawable(this.getContext(), res); + mPdfViewCtrlTabHostFragment.getToolbar().setOverflowIcon(icon); + } + } + getPdfViewCtrl().addPageChangeListener(mPageChangeListener); getPdfViewCtrl().addOnCanvasSizeChangeListener(mOnCanvasSizeChangeListener); getPdfViewCtrl().addOnLayoutChangeListener(mLayoutChangedListener); diff --git a/conf.json b/conf.json new file mode 100644 index 000000000..b6b006431 --- /dev/null +++ b/conf.json @@ -0,0 +1,38 @@ +{ + "tags": { + "allowUnknownTags": ["optional", "category", "hidesource"] + }, + "plugins": ["plugins/markdown", + "node_modules/better-docs/typescript", + "node_modules/better-docs/category" + ], + "source": { + "includePattern": "\\.(jsx|js|ts|tsx)$", + "include": ["lib/", "index.ts"], + "exclude": ["lib/index.js"] + }, + "templates": { + "systemName" : "PDFTron React Native", + "collapseSymbols" : false, + "hideAttribs" : true, + "detailsSameLine" : true, + "returnsInTable" : true, + "hideMethodSignature" : true, + "outputSourceFiles" : true, + "outputSourcePath" : true, + "linenums" : true, + "sourceRoot" : "https://github.com/PDFTron/pdftron-react-native/blob/ts-typedocs-master/", + "renderConstantsFor" : ["Config.js"], + "sort" : "category", + "categories" : true, + "collapseCategories" : true, + "categoriesFor" : ["DocumentView"] + + }, + "opts": { + "template": "./node_modules/ink-docstrap/template-algolia", + "destination": "./docs/", + "recurse": true, + "readme": "DocHome.md" + } +} \ No newline at end of file diff --git a/docs/Config.html b/docs/Config.html new file mode 100644 index 000000000..0a0226d39 --- /dev/null +++ b/docs/Config.html @@ -0,0 +1,2944 @@ + + + + + + + PDFTron React Native Class: Config + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + +
+ +
+ +

+ Config +

+ +

Defines configuration constants for the viewer. +See Config.ts +for the full list of constants.

+

Due to the length of the source file, we have included links to the exact lines +of the source code where these APIs have been implemented.

+ + +
+ + +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 1 +
+ + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +

Members

+ +
+
+ + + +
+

Buttons

+ + +
+
+ +
+

Buttons define the various kinds of buttons for the viewer

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 18 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + editToolButton +
  • + +
  • + viewControlsButton +
  • + +
  • + freeHandToolButton +
  • + +
  • + highlightToolButton +
  • + +
  • + underlineToolButton +
  • + +
  • + squigglyToolButton +
  • + +
  • + strikeoutToolButton +
  • + +
  • + rectangleToolButton +
  • + +
  • + ellipseToolButton +
  • + +
  • + lineToolButton +
  • + +
  • + arrowToolButton +
  • + +
  • + polylineToolButton +
  • + +
  • + polygonToolButton +
  • + +
  • + cloudToolButton +
  • + +
  • + signatureToolButton +
  • + +
  • + freeTextToolButton +
  • + +
  • + stickyToolButton +
  • + +
  • + calloutToolButton +
  • + +
  • + stampToolButton +
  • + +
  • + toolsButton +
  • + +
  • + searchButton +
  • + +
  • + shareButton +
  • + +
  • + editPagesButton +
  • + +
  • + viewLayersButton +
  • + +
  • + printButton +
  • + +
  • + closeButton +
  • + +
  • + saveCopyButton +
  • + +
  • + saveIdenticalCopyButton +
  • + +
  • + saveFlattenedCopyButton +
  • + +
  • + formToolsButton +
  • + +
  • + fillSignToolsButton +
  • + +
  • + moreItemsButton +
  • + +
  • + digitalSignatureButton +
  • + +
  • + thumbnailsButton +
  • + +
  • + listsButton +
  • + +
  • + thumbnailSlider +
  • + +
  • + outlineListButton +
  • + +
  • + annotationListButton +
  • + +
  • + userBookmarkListButton +
  • + +
  • + reflowButton +
  • + +
  • + editMenuButton +
  • + +
  • + cropPageButton +
  • + +
  • + undo +
  • + +
  • + redo +
  • + +
  • + addPageButton +
  • + +
  • + saveReducedCopyButton +
  • + +
  • + saveCroppedCopyButton +
  • + +
  • + savePasswordCopyButton +
  • +
+ + + +
+ + + +
+ + +
+

Tools

+ + +
+
+ +
+

Tools define the various kinds of tools for the viewer

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 73 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + annotationEdit +
  • + +
  • + textSelect +
  • + +
  • + multiSelect +
  • + +
  • + pan +
  • + +
  • + annotationEraserTool +
  • + +
  • + annotationCreateSticky +
  • + +
  • + annotationCreateFreeHand +
  • + +
  • + annotationCreateTextHighlight +
  • + +
  • + annotationCreateTextUnderline +
  • + +
  • + annotationCreateTextSquiggly +
  • + +
  • + annotationCreateTextStrikeout +
  • + +
  • + annotationCreateFreeText +
  • + +
  • + annotationCreateCallout +
  • + +
  • + annotationCreateSignature +
  • + +
  • + annotationCreateLine +
  • + +
  • + annotationCreateArrow +
  • + +
  • + annotationCreatePolyline +
  • + +
  • + annotationCreateStamp +
  • + +
  • + annotationCreateRubberStamp +
  • + +
  • + annotationCreateRectangle +
  • + +
  • + annotationCreateEllipse +
  • + +
  • + annotationCreatePolygon +
  • + +
  • + annotationCreatePolygonCloud +
  • + +
  • + annotationCreateDistanceMeasurement +
  • + +
  • + annotationCreatePerimeterMeasurement +
  • + +
  • + annotationCreateAreaMeasurement +
  • + +
  • + annotationCreateFileAttachment +
  • + +
  • + annotationCreateSound +
  • + +
  • + annotationCreateRedaction +
  • + +
  • + annotationCreateLink +
  • + +
  • + annotationCreateRedactionText +
  • + +
  • + annotationCreateLinkText +
  • + +
  • + annotationCreateFreeHighlighter +
  • + +
  • + annotationCreateSmartPen +
  • + +
  • + formCreateTextField +
  • + +
  • + formCreateCheckboxField +
  • + +
  • + formCreateSignatureField +
  • + +
  • + formCreateRadioField +
  • + +
  • + formCreateComboBoxField +
  • + +
  • + formCreateListBoxField +
  • + +
  • + pencilKitDrawing +
  • +
+ + + +
+ + + +
+ + +
+

FitMode

+ + +
+
+ +
+

FitMode define how a page should fit relative to the viewer, +alternatively, the default zoom level

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 122 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + FitPage +
  • + +
  • + FitWidth +
  • + +
  • + FitHeight +
  • + +
  • + Zoom +
  • +
+ + + +
+ + + +
+ + +
+

LayoutMode

+ + +
+
+ +
+

LayoutMode defines the layout mode of the viewer

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 132 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + Single +
  • + +
  • + Continuous +
  • + +
  • + Facing +
  • + +
  • + FacingContinuous +
  • + +
  • + FacingCover +
  • + +
  • + FacingCoverContinuous +
  • +
+ + + +
+ + + +
+ + +
+

FieldFlags

+ + +
+
+ +
+

FieldFlags define the property flags for a form field

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 144 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + ReadOnly +
  • + +
  • + Required +
  • +
+ + + +
+ + + +
+ + +
+

AnnotationMenu

+ + +
+
+ +
+

AnnotationMenu defines the menu items when an annotation is selected

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 152 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + style +
  • + +
  • + note +
  • + +
  • + copy +
  • + +
  • + duplicate +
  • + +
  • + delete +
  • + +
  • + flatten +
  • + +
  • + editText +
  • + +
  • + editInk +
  • + +
  • + search +
  • + +
  • + share +
  • + +
  • + markupType +
  • + +
  • + read +
  • + +
  • + screenCapture +
  • + +
  • + playSound +
  • + +
  • + openAttachment +
  • + +
  • + calibrate +
  • +
+ + + +
+ + + +
+ + +
+

EraserType

+ + +
+
+ +
+

EraserType defines the type of eraser that will be used when eraser is selected

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 174 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + annotationEraser +
  • + +
  • + hybrideEraser +
  • + +
  • + inkEraser +
  • +
+ + + +
+ + + +
+ + +
+

LongPressMenu

+ + +
+
+ +
+

LongPressMenu defines the menu items when a long press on empty space or text occurs

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 183 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + copy +
  • + +
  • + paste +
  • + +
  • + search +
  • + +
  • + share +
  • + +
  • + read +
  • +
+ + + +
+ + + +
+ + +
+

Actions

+ + +
+
+ +
+

Actions define potentially overridable action to the viewer

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 194 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + linkPress +
  • + +
  • + stickyNoteShowPopUp +
  • +
+ + + +
+ + + +
+ + +
+

AnnotationFlags

+ + +
+
+ +
+

AnnotationFlags define the flags for any annotation in the document

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 202 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + hidden +
  • + +
  • + invisible +
  • + +
  • + locked +
  • + +
  • + lockedContents +
  • + +
  • + noRotate +
  • + +
  • + noView +
  • + +
  • + noZoom +
  • + +
  • + print +
  • + +
  • + readOnly +
  • + +
  • + toggleNoView +
  • +
+ + + +
+ + + +
+ + +
+

DefaultToolbars

+ + +
+
+ +
+

DefaultToolbars define a set of pre-designed toolbars for easier customization

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 218 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + View +
  • + +
  • + Annotate +
  • + +
  • + Draw +
  • + +
  • + Insert +
  • + +
  • + FillAndSign +
  • + +
  • + PrepareForm +
  • + +
  • + Measure +
  • + +
  • + Pens +
  • + +
  • + Redaction +
  • + +
  • + Favorite +
  • +
+ + + +
+ + + +
+ + +
+

ToolbarIcons

+ + +
+
+ +
+

ToolbarIcons define default toolbar icons for use for potential custom toolbars

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 234 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + View +
  • + +
  • + Annotate +
  • + +
  • + Draw +
  • + +
  • + Insert +
  • + +
  • + FillAndSign +
  • + +
  • + PrepareForm +
  • + +
  • + Measure +
  • + +
  • + Pens +
  • + +
  • + Redaction +
  • + +
  • + Favorite +
  • +
+ + + +
+ + + +
+ + +
+

CustomToolbarKey

+ + +
+
+ +
+

CustomToolbarKey defines the necessary keys for a custom toolbar

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 250 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + Id +
  • + +
  • + Name +
  • + +
  • + Icon +
  • + +
  • + Items +
  • +
+ + + +
+ + + +
+ + +
+

ThumbnailFilterMode

+ + +
+
+ +
+

ThumbnailFilterMode defines filter modes in the thumbnails browser

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 260 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + Annotated +
  • + +
  • + Bookmarked +
  • +
+ + + +
+ + + +
+ + +
+

Conversion

+ + +
+
+ +
+

Conversion defines conversion sources and destinations

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 268 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + Screen +
  • + +
  • + Canvas +
  • + +
  • + Page +
  • +
+ + + +
+ + + +
+ + +
+

ViewModePickerItem

+ + +
+
+ +
+

ViewModePickerItem defines view mode items in the view mode dialog

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 277 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + Crop +
  • + +
  • + Rotation +
  • + +
  • + ColorMode +
  • +
+ + + +
+ + + +
+ + +
+

ZoomLimitMode

+ + +
+
+ +
+

ZoomLimitMode defines the limit mode for zoom in the current document viewer

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 286 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + None +
  • + +
  • + Absolute +
  • + +
  • + Relative +
  • +
+ + + +
+ + + +
+ + +
+

OverprintMode

+ + +
+
+ +
+

OverprintMode defines when overprint would be applied in the viewer

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 295 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + On +
  • + +
  • + Off +
  • + +
  • + OnlyPDFX +
  • +
+ + + +
+ + + +
+ + +
+

ColorPostProcessMode

+ + +
+
+ +
+

ColorPostProcessMode defines color modifications after rendering in the viewer

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 304 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + None +
  • + +
  • + Invert +
  • + +
  • + GradientMap +
  • + +
  • + NightMode +
  • +
+ + + +
+ + + +
+ + +
+

ReflowOrientation

+ + +
+
+ +
+

ReflowOrientation defines the scrolling direction when in reflow viewing mode

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 314 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + Horizontal +
  • + +
  • + Vertical +
  • +
+ + + +
+ + + +
+ + +
+

ExportFormat

+ + +
+
+ +
+

Export to format

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 322 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + BMP +
  • + +
  • + JPEG +
  • + +
  • + PNG +
  • +
+ + + +
+ + + +
+ + +
+

AnnotationManagerEditMode

+ + +
+
+ +
+

AnnotationManagerEditMode determines whose changes can be edited.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 331 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + Own +
  • + +
  • + All +
  • +
+ + + +
+ + + +
+ + +
+

AnnotationManagerUndoMode

+ + +
+
+ +
+

AnnotationManagerUndoMode determines whose changes can be undone.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + Config.js + + line 339 +
+ + + + + + + + + + + + + +
+ + + +
Constants:
+
    +
  • + Own +
  • + +
  • + All +
  • +
+ + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DocumentView.html b/docs/DocumentView.html new file mode 100644 index 000000000..2de974404 --- /dev/null +++ b/docs/DocumentView.html @@ -0,0 +1,31310 @@ + + + + + + + PDFTron React Native Class: DocumentView + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + +
+ +
+ +

+ DocumentView +

+ +

An all-in-one React component for displaying and editing documents of different types +such as PDF, docx, pptx, xlsx and various image formats.

+

Due to the length of the source file, we have included links to the exact lines of the source +code where these APIs have been implemented.

+ + +
+ + +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 1845 +
+ + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +

Members

+ +
+

Annotation Menu


+ + + +
+

annotationMenuItems

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +Array<Config.AnnotationMenu> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Contains all the items. +
+ + + +
+ Source: + DocumentView.js + + line 374 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  annotationMenuItems={[Config.AnnotationMenu.search, Config.AnnotationMenu.share]}
+/>
+ + + +
+ + + +
+ + +
+

overrideAnnotationMenuBehavior

+ + +
+
+ +
+

Defines the menu items that will skip default behavior when pressed. +They will still be displayed in the annotation menu, +and the function onAnnotationMenuPress +will be called where custom behavior can be implemented.

+
+ + + + +
+ Type: + +Array<Config.AnnotationMenu> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 390 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  overrideAnnotationMenuBehavior={[Config.AnnotationMenu.copy]}
+/>
+ + + +
+ + + +
+ + +
+

hideAnnotationMenu

+ + +
+
+ +
+

Defines annotation types that will not show in the annotation (long-press) menu.

+
+ + + + +
+ Type: + +Array<Config.Tools> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 436 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  hideAnnotationMenu={[Config.Tools.annotationCreateArrow, Config.Tools.annotationEraserTool]}
+/>
+ + + +
+ +
+

Annotations


+ + + +
+

continuousAnnotationEditing

+ + +
+
+ +
+

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.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 785 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  continuousAnnotationEditing={true}
+/>
+ + + +
+ + + +
+ + +
+

selectAnnotationAfterCreation

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 799 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  selectAnnotationAfterCreation={true}
+/>
+ + + +
+ + + +
+ + +
+

annotationAuthor

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 812 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  annotationAuthor={'PDFTron'}
+/>
+ + + +
+ + + +
+ + +
+

annotationPermissionCheckEnabled

+ + +
+
+ +
+

Defines whether an annotation's permission flags will be respected when it is selected. +For example, a locked annotation can not be resized or moved.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 1063 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  annotationPermissionCheckEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

annotationsListEditingEnabled

+ + +
+
+ +
+

If document editing is enabled, then this value determines +if the annotation list is editable.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1395 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  annotationsListEditingEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

inkMultiStrokeEnabled

+ + +
+
+ +
+

If true, ink tool will use multi-stroke mode. +Otherwise, each stroke is a new ink annotation.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1529 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  inkMultiStrokeEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

disableEditingByAnnotationType

+ + +
+
+ +
+

Defines annotation types that cannot be edited after creation.

+
+ + + + +
+ Type: + +Array<Config.Tools> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 1592 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  disableEditingByAnnotationType={[Config.Tools.annotationCreateTextSquiggly,
+    Config.Tools.annotationCreateEllipse]}
+/>
+ + + +
+ + + +
+ + +
+

excludedAnnotationListTypes

+ + +
+
+ +
+

Defines types to be excluded from the annotation list.

+
+ + + + +
+ Type: + +Array<Config.Tools> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 1651 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  excludedAnnotationListTypes={[Config.Tools.annotationCreateEllipse,
+    Config.Tools.annotationCreateRectangle,
+    Config.Tools.annotationCreateRedaction]}
+/>
+ + + +
+ +
+

Bookmark


+ + + +
+

userBookmarksListEditingEnabled

+ + +
+
+ +
+

Defines whether the bookmark list can be edited. +If the viewer is readonly then bookmarks on Android are +still editable but are saved to the device rather than the PDF.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1436 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  userBookmarksListEditingEnabled={true}
+/>
+ + + +
+ +
+

Collaboration


+ + + +
+

collabEnabled

+ + +
+
+ +
+

Defines whether to enable realtime collaboration. +If true then currentUser must be set as well for +collaboration mode to work. Feature set may vary between local and collaboration mode.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 860 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  collabEnabled={true}
+  currentUser={'Pdftron'}
+/>
+ + + +
+ + + +
+ + +
+

currentUser

+ + +
+
+ +
+

Required if collabEnabled is set to true.

+

Defines the current user. +Created annotations will have their title (author) set to this string.

+
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 875 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  collabEnabled={true}
+  currentUser={'Pdftron'}
+/>
+ + + +
+ + + +
+ + +
+

currentUserName

+ + +
+
+ +
+

Defines the current user name. +Will set the user name only if collabEnabled is true +and currentUser is defined. This should be used only if +you want the user's display name to be different than the annotation's title/author +(in the case that currentUser is an ID rather than a +human-friendly name.)

+
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 894 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  collabEnabled={true}
+  currentUser={'Pdftron'}
+  currentUserName={'Hello_World'}
+/>
+ + + +
+ + + +
+ + +
+

replyReviewStateEnabled

+ + +
+
+ +
+

Android only.

+

Defines whether to show an annotation's reply review state.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1668 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  collabEnabled={true}
+  currentUser={'Pdftron'}
+  replyReviewStateEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

annotationManagerEditMode

+ + +
+
+ +
+

Sets annotation manager edit mode when collabEnabled +is true.

+ + + + + + + + + + + + + + + + + +
ModeDescription
Config.AnnotationManagerEditMode.OwnIn this mode, you can edit only your own changes
Config.AnnotationManagerEditMode.AllIn this mode, you can edit everyone's changes
+
+ + + + +
+ Type: + +Config.AnnotationManagerEditMode + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Config.AnnotationManagerEditMode.Own +
+ + + +
+ Source: + DocumentView.js + + line 1689 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  collabEnabled={true}
+  currentUser={'Pdftron'}
+  annotationManagerEditMode={Config.AnnotationManagerEditMode.Own}
+/>
+ + + +
+ + + +
+ + +
+

annotationManagerUndoMode

+ + +
+
+ +
+

Sets annotation manager undo mode when collabEnabled +is true.

+ + + + + + + + + + + + + + + + + +
ModeDescription
Config.AnnotationManagerUndoMode.OwnIn this mode, you can undo only your own changes
Config.AnnotationManagerUndoMode.AllIn this mode, you can undo everyone's changes
+
+ + + + +
+ Type: + +Config.AnnotationManagerUndoMode + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Config.AnnotationManagerUndoMode.Own +
+ + + +
+ Source: + DocumentView.js + + line 1710 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  collabEnabled={true}
+  currentUser={'Pdftron'}
+  annotationManagerUndoMode={Config.AnnotationManagerUndoMode.Own}
+/>
+ + + +
+ +
+

Custom Behavior


+ + + +
+

overrideBehavior

+ + +
+
+ +
+

Defines actions that will skip default behavior, such as external link click. +The function onBehaviorActivated will be +called where custom behavior can be implemented, whenever the defined actions occur.

+
+ + + + +
+ Type: + +Array<Config.Actions> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 451 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  overrideBehavior={[Config.Actions.linkPress]}
+/>
+ + + +
+ +
+

Layout


+ + + +
+

fitMode

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +Config.FitMode + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Config.FitMode.FitWidth +
+ + + +
+ Source: + DocumentView.js + + line 728 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  fitMode={Config.FitMode.FitPage}
+/>
+ + + +
+ + + +
+ + +
+

layoutMode

+ + +
+
+ +
+

Defines the layout mode of the viewer.

+
+ + + + +
+ Type: + +Config.LayoutMode + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Config.LayoutMode.Continuous +
+ + + +
+ Source: + DocumentView.js + + line 741 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  layoutMode={Config.LayoutMode.FacingContinuous}
+/>
+ + + +
+ +
+

Long Press Menu


+ + + +
+

longPressMenuItems

+ + +
+
+ +
+

Defines menu items that can show when long press on text or blank space.

+
+ + + + +
+ Type: + +Array<Config.LongPressMenu> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Contains all the items. +
+ + + +
+ Source: + DocumentView.js + + line 310 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  longPressMenuItems={[Config.LongPressMenu.copy, Config.LongPressMenu.read]}
+/>
+ + + +
+ + + +
+ + +
+

overrideLongPressMenuBehavior

+ + +
+
+ +
+

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 function onLongPressMenuPress +will be called where custom behavior can be implemented.

+
+ + + + +
+ Type: + +Array<Config.LongPressMenu> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 326 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  overrideLongPressMenuBehavior={[Config.LongPressMenu.search]}
+/>
+ + + +
+ + + +
+ + +
+

longPressMenuEnabled

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 361 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  longPressMenuEnabled={true}
+/>
+ + + +
+ +
+

Multi-tab


+ + + +
+

multiTabEnabled

+ + +
+
+ +
+

Defines whether viewer will use tabs in order to have more than +one document open simultaneously (like a web browser). Changing the +document prop value will cause a new tab +to be opened with the associated file.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 1005 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  multiTabEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

tabTitle

+ + +
+
+ +
+

Set the tab title if multiTabEnabled is true.

+
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + the file name +
+ + + +
+ Source: + DocumentView.js + + line 1019 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  multiTabEnabled={true}
+  tabTitle={'tab1'}
+/>
+ + + +
+ + + +
+ + +
+

maxTabCount

+ + +
+
+ +
+

Sets the limit on the maximum number of tabs that the viewer could have at a time. +Open more documents after reaching this limit will overwrite the old tabs.

+
+ + + + +
+ Type: + +number + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + unlimited +
+ + + +
+ Source: + DocumentView.js + + line 1034 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  multiTabEnabled={true}
+  maxTabCount={5}
+/>
+ + + +
+ +
+

Navigation


+ + + +
+

pageStackEnabled

+ + +
+
+ +
+

Android only.

+

Defines whether the page stack navigation buttons will appear in the viewer.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ Deprecated: + Use the showQuickNavigationButton +prop instead. +
+ + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1340 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  pageStackEnabled={false}
+/>
+ + + +
+ + + +
+ + +
+

showQuickNavigationButton

+ + +
+
+ +
+

Defines whether the quick navigation buttons will appear in the viewer.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1353 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  showQuickNavigationButton={false}
+/>
+ + + +
+ + + +
+ + +
+

showNavigationListAsSidePanelOnLargeDevices

+ + +
+
+ +
+

Defines whether the navigation list will be displayed as a side panel +on large devices such as iPads and tablets.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true on Android and false on iOS +
+ + + +
+ Source: + DocumentView.js + + line 1409 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  showNavigationListAsSidePanelOnLargeDevices={true}
+/>
+ + + +
+ +
+

Open a Document


+ + + +
+

document

+ + +
+
+ +
+

The path or url to the document. Required.

+
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 33 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  document={'https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_about.pdf'}
+/>
+ + + +
+ + + +
+ + +
+

password

+ + +
+
+ +
+

The password of the document, if any.

+
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 45 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  password={'password'}
+/>
+ + + +
+ + + +
+ + +
+

customHeaders

+ + +
+
+ +
+

Defines custom headers to use with HTTP/HTTPS requests.

+
+ + + + +
+ Type: + +object + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 84 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  customHeaders={{headerKey: 'headerValue'}}
+/>
+ + + +
+ + + +
+ + +
+

readOnly

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 701 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  readOnly={true}
+/>
+ + + +
+ + + +
+ + +
+

isBase64String

+ + +
+
+ +
+

If true, document prop will be treated as a base64 string. +If it is not the base64 string of a pdf file, +base64FileExtension is required.

+

When viewing a document initialized with a base64 string (i.e. a memory buffer), +a temporary file is created on Android and iOS.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 844 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  isBase64String={true}
+  document={'...'} // base 64 string
+/>
+ + + +
+ + + +
+ + +
+

defaultEraserType

+ + +
+
+ +
+

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

+ + + + + + + + + + + + + +
Eraser TypeDescription
annotationEraserErases 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.

+
+ + + + +
+ Type: + +Config.EraserType + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1548 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  defaultEraserType={Config.EraserType.hybrideEraser}
+/>
+ + + +
+ + + +
+ + +
+

exportPath

+ + +
+
+ +
+

Android only.

+

Sets the folder path for all save options, this defaults to the app cache path. +Example:

+
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1563 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  exportPath="/data/data/com.example/cache/test"
+/>
+ + + +
+ + + +
+ + +
+

openUrlPath

+ + +
+
+ +
+

Android only.

+

Sets the cache folder used to cache PDF files opened using a http/https link, +this defaults to the app cache path.

+
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1578 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  openUrlPath="/data/data/com.example/cache/test"
+/>
+ + + +
+ + + +
+ + +
+

saveStateEnabled

+ + +
+
+ +
+

Sets whether to remember the last visited page and zoom for a +document if it gets opened again.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1621 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  saveStateEnabled={false}
+/>
+ + + +
+ + + +
+ + +
+

openSavedCopyInNewTab

+ + +
+
+ +
+

Android only.

+

Sets whether the new saved file should open after saving.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1636 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  openSavedCopyInNewTab={false}
+/>
+ + + +
+ +
+

Other


+ + + +
+

autoSaveEnabled

+ + +
+
+ +
+

Defines whether document is automatically saved by the viewer.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 947 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  autoSaveEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

followSystemDarkMode

+ + +
+
+ +
+

Android and iOS 13+ only

+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 976 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  followSystemDarkMode={false}
+/>
+ + + +
+ + + +
+ + +
+

useStylusAsPen

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 989 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  useStylusAsPen={true}
+/>
+ + + +
+ + + +
+ + +
+

autoResizeFreeTextEnabled

+ + +
+
+ +
+

Defines whether to automatically resize the bounding box of free +text annotations when editing.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 1381 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  autoResizeFreeTextEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

restrictDownloadUsage

+ + +
+
+ +
+

Defines whether to restrict data usage when viewing online PDFs.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 1421 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  restrictDownloadUsage={true}
+/>
+ + + +
+ +
+

Page


+ + + +
+

initialPageNumber

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +number + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 58 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  initialPageNumber={5}
+/>
+ + + +
+ + + +
+ + +
+

pageNumber

+ + +
+
+ +
+

Defines the currently displayed page number. +Different from initialPageNumber, +changing this prop value at runtime will change the page accordingly.

+
+ + + + +
+ Type: + +number + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 72 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  pageNumber={5}
+/>
+ + + +
+ + + +
+ + +
+

pageIndicatorEnabled

+ + +
+
+ +
+

Defines whether to show the page indicator for the viewer.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 548 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  pageIndicatorEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

keyboardShortcutsEnabled

+ + +
+
+ +
+

iOS only

+

Defines whether the keyboard shortcuts of the viewer are enabled.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 578 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  keyboardShortcutsEnabled={false}
+/>
+ + + +
+ + + +
+ + +
+

pageChangeOnTap

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 961 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  pageChangeOnTap={true}
+/>
+ + + +
+ +
+

Reflow


+ + + +
+

imageInReflowEnabled

+ + +
+
+ +
+

Will be available on iOS in version 9.1.2 and greater

+

Whether to show images in reflow mode.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1451 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  imageInReflowEnabled={false}
+/>
+ + + +
+ + + +
+ + +
+

reflowOrientation

+ + +
+
+ +
+

Android only.

+

Sets the scrolling direction of the reflow control.

+
+ + + + +
+ Type: + +Config.ReflowOrientation + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to the viewer's scroll direction +
+ + + +
+ Source: + DocumentView.js + + line 1466 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  reflowOrientation={Config.ReflowOrientation.Vertical}
+/>
+ + + +
+ +
+

Scroll


+ + + +
+

horizontalScrollPos

+ + +
+
+ +
+

Defines the horizontal scroll position in the current document viewer.

+
+ + + + +
+ Type: + +number + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1240 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  horizontalScrollPos={50}
+/>
+ + + +
+ + + +
+ + +
+

verticalScrollPos

+ + +
+
+ +
+

Defines the vertical scroll position in the current document viewer.

+
+ + + + +
+ Type: + +number + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1252 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  verticalScrollPos={50}
+/>
+ + + +
+ + + +
+ + +
+

hideScrollbars

+ + +
+
+ +
+

iOS only.

+

Determines whether scrollbars will be hidden on the viewer.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 1607 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  hideScrollbars={true}
+/>
+ + + +
+ +
+

Signature


+ + + +
+

showSavedSignatures

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 825 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  showSavedSignatures={true}
+/>
+ + + +
+ + + +
+ + +
+

signSignatureFieldsWithStamps

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 1049 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  signSignatureFieldsWithStamps={true}
+/>
+ + + +
+ + + +
+ + +
+

photoPickerEnabled

+ + +
+
+ +
+

Android only.

+

Defines whether to show the option to pick images in the signature dialog.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true. +
+ + + +
+ Source: + DocumentView.js + + line 1368 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  photoPickerEnabled={true}
+/>
+ + + +
+ +
+

Thumbnails


+ + + +
+

thumbnailViewEditingEnabled

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 715 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  thumbnailViewEditingEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

hideThumbnailFilterModes

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +Array<Config.ThumbnailFilterMode> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1208 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  hideThumbnailFilterModes={[Config.ThumbnailFilterMode.Annotated]}
+/>
+ + + +
+ +
+

Toolbar Customization


+ + + +
+

topToolbarEnabled

+ + +
+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ Deprecated: + Use the hideTopAppNavBar prop instead. +
+ + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 494 +
+ + + + + + + + + + + + + +
+ + + + + +
+ + + +
+ + +
+

bottomToolbarEnabled

+ + +
+
+ +
+

Defines whether the bottom toolbar of the viewer is enabled.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 507 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  bottomToolbarEnabled={false}
+/>
+ + + +
+ + + +
+ + +
+

hideToolbarsOnTap

+ + +
+
+ +
+

Defines whether an unhandled tap in the viewer should toggle the visibility +of the top and bottom toolbars. When false, the top and bottom toolbar visibility +will not be toggled and the page content will fit between the bars, if any.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 522 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  hideToolbarsOnTap={false}
+/>
+ + + +
+ + + +
+ + +
+

padStatusBar

+ + +
+
+ +
+

Android only

+

Defines whether the viewer will add padding to take account of the system status bar.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 771 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  padStatusBar={true}
+/>
+ + + +
+ + + +
+ + +
+

annotationToolbars

+ + +
+
+ +
+

Type can be array of Config.DefaultToolbars constants or custom toolbar objects.

+

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

+
+ + + + +
+ Type: + +Array<Config.DefaultToolbars> +| + +object + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 1087 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
const myToolbar = {
+  [Config.CustomToolbarKey.Id]: 'myToolbar',
+  [Config.CustomToolbarKey.Name]: 'myToolbar',
+  [Config.CustomToolbarKey.Icon]: Config.ToolbarIcons.FillAndSign,
+  [Config.CustomToolbarKey.Items]: [Config.Tools.annotationCreateArrow,
+     Config.Tools.annotationCreateCallout, Config.Buttons.undo]
+};
+...
+<DocumentView
+  annotationToolbars={[Config.DefaultToolbars.Annotate, myToolbar]}
+/>
+ + + +
+ + + +
+ + +
+

hideDefaultAnnotationToolbars

+ + +
+
+ +
+

Defines which default annotation toolbars should be hidden. +Note that this prop should be used when +annotationToolbars is not defined.

+
+ + + + +
+ Type: + +Array<Config.DefaultToolbars> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 1111 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  hideDefaultAnnotationToolbars={[Config.DefaultToolbars.Annotate,
+    Config.DefaultToolbars.Favorite]}
+/>
+ + + +
+ + + +
+ + +
+

topAppNavBarRightBar

+ + +
+
+ +
+

iOS only

+

Customizes the right bar section of the top app nav bar. +If passed in, the default right bar section will not be used.

+
+ + + + +
+ Type: + +Array<Config.Buttons> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1126 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  topAppNavBarRightBar={[Config.Buttons.reflowButton, Config.Buttons.outlineListButton]}
+/>
+ + + +
+ + + +
+ + +
+

bottomToolbar

+ + +
+
+ +
+

Only the outline list, thumbnail list, share, view mode, +search, and reflow buttons are supported on Android.

+

Defines a custom bottom toolbar. If passed in, the default bottom toolbar will not be used.

+
+ + + + +
+ Type: + +Array<Config.Buttons> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1141 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  bottomToolbar={[Config.Buttons.reflowButton, Config.Buttons.outlineListButton]}
+/>
+ + + +
+ + + +
+ + +
+

hideAnnotationToolbarSwitcher

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 1154 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  hideAnnotationToolbarSwitcher={false}
+/>
+ + + +
+ + + +
+ + +
+

hideTopToolbars

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 1167 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  hideTopToolbars={false}
+/>
+ + + +
+ + + +
+ + +
+

hideTopAppNavBar

+ + +
+
+ +
+

Defines whether to hide the top navigation app bar.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + false +
+ + + +
+ Source: + DocumentView.js + + line 1180 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  hideTopAppNavBar={true}
+/>
+ + + +
+ + + +
+ + +
+

initialToolbar

+ + +
+
+ +
+

Type can be one of the Config.DefaultToolbars constants +or the id of a custom toolbar object.

+

Defines which annotationToolbar +should be selected when the document is opened.

+
+ + + + +
+ Type: + +Config.DefaultToolbars +| + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 1515 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  initialToolbar={Config.DefaultToolbars.Draw}
+/>
+ + + +
+ +
+

UI Customization


+ + + +
+

leadingNavButtonIcon

+ + +
+
+ +
+

The file name of the icon to be used for the leading navigation button. +The button will use the specified icon if it is valid, and the default icon otherwise.

+

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

+
Android
+
    +
  1. Add the image resource to the drawable directory in +example/android/app/src/main/res. +For details about supported file types and potential compression, check out +here.
  2. +
+demo-android +

+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 example.xcworkspace), +and navigate through the list below. +This would allow you to add resources, in this case, an image, to your project.
  2. +
+
    +
  • "Project navigator"
  • +
  • "example" (or the app name)
  • +
  • "Build Phases"
  • +
  • "Copy Bundle Resources"
  • +
  • "+".
  • +
+demo-ios +

+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. +
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 131 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
let iosNav = 'ic_close_black_24px.png';
+let androidNav = 'ic_arrow_back_white_24dp';
+<DocumentView
+  leadingNavButtonIcon={Platform.OS === 'ios' ? iosNav : androidNav}
+/>
+ + + +
+ + + +
+ + +
+

showLeadingNavButton

+ + +
+
+ +
+

Defines whether to show the leading navigation button.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 144 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  showLeadingNavButton={true}
+/>
+ + + +
+ + + +
+ + +
+

disabledElements

+ + +
+
+ +
+

Defines buttons to be disabled for the viewer.

+
+ + + + +
+ Type: + +Array<Config.Buttons> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 284 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  disabledElements={[Config.Buttons.userBookmarkListButton]}
+/>
+ + + +
+ + + +
+ + +
+

disabledTools

+ + +
+
+ +
+

Defines tools to be disabled for the viewer.

+
+ + + + +
+ Type: + +Array<Config.Tools> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 297 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  disabledTools={[Config.Tools.annotationCreateLine, Config.Tools.annotationCreateRectangle]}
+/>
+ + + +
+ + + +
+ + +
+

documentSliderEnabled

+ + +
+
+ +
+

Defines whether the document slider of the viewer is enabled.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 535 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  documentSliderEnabled={false}
+/>
+ + + +
+ + + +
+ + +
+

downloadDialogEnabled

+ + +
+
+ +
+

Android only.

+

Defines whether the download dialog should be shown.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 563 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+   downloadDialogEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

hideViewModeItems

+ + +
+
+ +
+

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

+
+ + + + +
+ Type: + +Array<Config.ViewModePickerItem> + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + Defaults to none. +
+ + + +
+ Source: + DocumentView.js + + line 1323 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  hideViewModeItems={[
+    Config.ViewModePickerItem.Crop,
+    Config.ViewModePickerItem.Rotation,
+    Config.ViewModePickerItem.ColorMode
+  ]}
+/>
+ + + +
+ + + +
+ + +
+

tabletLayoutEnabled

+ + +
+
+ +
+

Android only.

+

Defines whether the tablet layout should be used on tablets. +Otherwise uses the same layout as phones.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1498 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  tabletLayoutEnabled={true}
+/>
+ + + +
+ + + +
+ + +
+

rememberLastUsedTool

+ + +
+
+ +
+

Android only.

+

Defines whether the last tool used in the current viewer session will +be the tool selected upon starting a new viewer session.

+
+ + + + +
+ Type: + +boolean + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + +
+ Default Value: + true +
+ + + +
+ Source: + DocumentView.js + + line 1764 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  rememberLastUsedTool={true}
+/>
+ + + +
+ + + +
+ + +
+

overflowMenuButtonIcon

+ + +
+
+ +
+

The file name of the icon to be used as the overflow menu button. +The button will use the specified icon if it is valid, and the default icon otherwise.

+

Note: to add the image file to your application, follow the steps under the Note +section of leadingNavButtonIcon.

+
+ + + + +
+ Type: + +string + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1782 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
let iosButton = 'ic_close_black_24px.png';
+let androidButton = 'ic_arrow_back_white_24dp';
+<DocumentView
+ overflowMenuButtonIcon={Platform.OS === 'ios' ? iosButton : androidButton}
+/>
+ + + +
+ +
+

Zoom


+ + + +
+

zoom

+ + +
+
+ +
+

Zoom factor used to display the page content.

+
+ + + + +
+ Type: + +number + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 271 +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +
<DocumentView
+  zoom={1}
+/>
+ + + +
+ +
+ + + +

Methods

+ +
+

Annotation Tools


+ + + +
+

setToolMode

+ + +
+
+ + +
+

Sets the current tool mode.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2049 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
toolMode + + +Config.Tools + + + + +

the tool mode to set.

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.setToolMode(Config.Tools.annotationCreateFreeHand).then(() => {
+  // done switching tools
+});
+ + + +
+ + + +
+ + +
+

commitTool

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2067 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
committed + + +Promise<(void|boolean)> + + + + + + + true if either ink or poly-shape tool is +committed, false otherwise

+ + +
+ + + + + + +
Example
+ +
this._viewer.commitTool().then((committed) => {
+  // committed: true if either ink or poly-shape tool is committed, false otherwise
+});
+ + + +
+ +
+

Annotations


+ + + +
+

flattenAnnotations

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2212 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
formsOnly + + +boolean + + + + +

Defines whether only forms are flattened. +If false, all annotations will be flattened.

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
// flatten forms and annotations in the current document.
+this._viewer.flattenAnnotations(false);
+ + + +
+ + + +
+ + +
+

deleteAnnotations

+ + +
+
+ + +
+

Deletes the specified annotations in the current document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2239 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotations + + +Array<object> + + + + +

Defines which annotation to be deleted. +Each element is in the format {id: string, pageNumber: int}

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
// delete annotations in the current document.
+this._viewer.deleteAnnotations([
+    {
+        id: 'annotId1',
+        pageNumber: 1,
+    },
+    {
+        id: 'annotId2',
+        pageNumber: 2,
+    }
+]);
+ + + +
+ + + +
+ + +
+

setFlagForFields

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2278 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fields + + +Array<string> + + + + +

list of field names for which the flag should be set

flag + + +Config.FieldFlags + + + + +

flag to be set

value + + +boolean + + + + +

value to set for flag

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.setFlagForFields(['First Name', 'Last Name'], Config.FieldFlags.ReadOnly, true);
+ + + +
+ + + +
+ + +
+

getField

+ + +
+
+ + +
+

Get type and value information of a field using its name.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2304 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fieldName + + +string + + + + +

name of the field

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
field + + +Promise<(void|object)> + + + + + + + an object with information keys: +fieldName, fieldValue (undefined for fields with no values) and +fieldType(one of button, checkbox, radio, text, choice, signature and unknown), +or undefined if such field does not exist

+ + +
+ + + + + + +
Example
+ +
this._viewer.getField('someFieldName').then((field) => {
+  if (field !== undefined) {
+    console.log('field name:', field.fieldName);
+    console.log('field value:', field.fieldValue);
+    console.log('field type:', field.fieldType);
+  }
+});
+ + + +
+ + + +
+ + +
+

openAnnotationList

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2320 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.openAnnotationList();
+ + + +
+ + + +
+ + +
+

setValuesForFields

+ + +
+
+ + +
+

Sets field values on one or more form fields.

+

Note: the old function setValueForFields is deprecated. Please use this one instead.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2354 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fieldsMap + + +object + + + + +

map of field names and values which should be set

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.setValuesForFields({
+  'textField1': 'Test',
+  'textField2': 1234,
+  'checkboxField1': true,
+  'checkboxField2': false,
+  'radioButton1': 'Yes',
+  'radioButton2': 'No'
+});
+ + + +
+ + + +
+ + +
+

setFlagsForAnnotations

+ + +
+
+ + +
+

Sets flags for specified annotations in the current document. +The flagValue controls whether a flag will be set to or removed from the annotation.

+

Note: the old function setFlagForAnnotations is deprecated. Please use this one.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2419 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotationFlagList + + +Array<object> + + + + +

A list of annotation flag operations. +Each element is in the format +{id: string, pageNumber: int, flag: One of Config.AnnotationFlags constants, flagValue: boolean}

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
//  Set flag for annotations in the current document.
+this._viewer.setFlagsForAnnotations([
+    {
+        id: 'annotId1',
+        pageNumber: 1,
+        flag: Config.AnnotationFlags.noView,
+        flagValue: true
+    },
+    {
+        id: 'annotId2',
+        pageNumber: 5,
+        flag: Config.AnnotationFlags.lockedContents,
+        flagValue: false
+    }
+]);
+ + + +
+ + + +
+ + +
+

selectAnnotation

+ + +
+
+ + +
+

Selects the specified annotation in the current document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2438 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + + +

the id of the target annotation

pageNumber + + +integer + + + + +

the page number where the targe annotation is located. +It is 1-indexed.

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
// select annotation in the current document.
+this._viewer.selectAnnotation('annotId1', 1);
+ + + +
+ + + +
+ + +
+

setPropertiesForAnnotation

+ + +
+
+ + +
+

Sets properties for specified annotation in the current document, if it is valid.

+

Note: the old function setPropertyForAnnotation is deprecated. Please use this one.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2503 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotationId + + +string + + + + +

the unique id of the annotation

pageNumber + + +integer + + + + +

the page number where annotation is located. It is 1-indexed

propertyMap + + +object + + + + +

an object containing properties to be set. +Available properties are listed below.

+

Properties in propertyMap:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeMarkup exclusiveExample
rectobjectno{x1: 1, y1: 2, x2: 3, y2: 4}
contentsstringno"contents"
subjectstringyes"subject"
titlestringyes"title"
contentRectobjectyes{x1: 1, y1: 2, x2: 3, y2: 4}
customDataobjectno{key: value}
strokeColorobjectno{red: 255, green: 0, blue: 0}
+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
// Set properties for annotation in the current document.
+this._viewer.setPropertiesForAnnotation('Pdftron', 1, {
+  rect: {
+    x1: 1.1,    // left
+    y1: 3,      // bottom
+    x2: 100.9,  // right
+    y2: 99.8    // top
+  },
+  contents: 'Hello World',
+  subject: 'Sample',
+  title: 'set-prop-for-annot',
+  customData: {
+    key1: 'value1',
+    key2: 'value2',
+    key3: 'value3'
+  },
+  strokeColor: {
+    "red": 255,
+    "green": 0,
+    "blue": 0
+  }
+});
+ + + +
+ + + +
+ + +
+

getPropertiesForAnnotation

+ + +
+
+ + +
+

Gets properties for specified annotation in the current document, if it is valid.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2535 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotationId + + +string + + + + +

the unique id of the annotation

pageNumber + + +integer + + + + +

the page number where annotation is located. It is 1-indexed

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
propertyMap + + +Promise<(void|object)> + + + + + + + the non-null properties of the annotation

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeMarkup exclusiveExample
rectobjectno{x1: 1, y1: 1, x2: 2, y2: 2, width: 1, height: 1}
contentsstringno"Contents"
subjectstringyes"Subject"
titlestringyes"Title"
contentRectobjectyes{x1: 1, y1: 1, x2: 2, y2: 2, width: 1, height: 1}
strokeColorobjectno{red: 255, green: 0, blue: 0}
+ + +
+ + + + + + +
Example
+ +
// Get properties for annotation in the current document.
+this._viewer.getPropertiesForAnnotation('Pdftron', 1).then((properties) => {
+  if (properties) {
+    console.log('Properties for annotation: ', properties);
+  }
+})
+ + + +
+ + + +
+ + +
+

setDrawAnnotations

+ + +
+
+ + +
+

Sets whether all annotations and forms should be rendered. +This method affects the viewer and does not change the document.

+

Unlike setVisibilityForAnnotation, +this method is used to show and hide all annotations and forms in the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2555 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
drawAnnotations + + +boolean + + + + +

whether all annotations and forms should be rendered

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.setDrawAnnotations(false);
+ + + +
+ + + +
+ + +
+

setVisibilityForAnnotation

+ + +
+
+ + +
+

Sets visibility for specified annotation in the current document, if it is valid. +Note that if drawAnnotations +is set to false in the viewer, this function would not render the annotation even +if visibility is true.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2577 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotationId + + +string + + + + +

the unique id of the annotation

pageNumber + + +integer + + + + +

the page number where annotation is located. It is 1-indexed

visibility + + +boolean + + + + +

whether the annotation should be visible

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.setVisibilityForAnnotation('Pdftron', 1, true);
+ + + +
+ + + +
+ + +
+

setHighlightFields

+ + +
+
+ + +
+

Enables or disables highlighting form fields. It is disabled by default.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2592 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
highlightFields + + +boolean + + + + +

whether form fields should be highlighted

+ + + + + + + + + + + + + + + + +
Example
+ +
this._viewer.setHighlightFields(true);
+ + + +
+ + + +
+ + +
+

getAnnotationAtPoint

+ + +
+
+ + +
+

Gets an annotation at the (x, y) position in screen coordinates, if any.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2626 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +integer + + + + +

the x-coordinate of the point

y + + +integer + + + + +

the y-coordinate of the point

distanceThreshold + + +double + + + + +

maximum distance from the point (x, y) +to the annotation for it to be considered a hit (in dp)

minimumLineWeight + + +double + + + + +

For very thin lines, +it is almost impossible to hit the actual line. +This specifies a minimum line thickness (in screen coordinates) for the purpose of calculating +whether a point is inside the annotation or not (in dp)

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotation + + +Promise<(void|object)> + + + + + + + the annotation found in the format of +{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}.

+

type is one of the Config.Tools constants.

+

screenRect was formerly called rect.

+ + +
+ + + + + + +
Example
+ +
this._viewer.getAnnotationAtPoint(167, 287, 100, 10).then((annotation) => {
+  if (annotation) {
+    console.log('Annotation found at point (167, 287) has id:', annotation.id);
+  }
+})
+ + + +
+ + + +
+ + +
+

getAnnotationListAt

+ + +
+
+ + +
+

Gets the list of annotations at a given line in screen coordinates. +Note that this is not an area selection. It should be used similar +to getAnnotationAtPoint, except that this should +be used when you want to get multiple annotations which are overlaying with each other.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2659 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x1 + + +integer + + + + +

x-coordinate of an endpoint on the line

y1 + + +integer + + + + +

y-coordinate of an endpoint on the line

x2 + + +integer + + + + +

x-coordinate of the other endpoint on the line, usually used as a threshold

y2 + + +integer + + + + +

y-coordinate of the other endpoint on the line, usually used as a threshold

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotations + + +Promise<(void|Array<object>)> + + + + + + + list of annotations at the target line, +each in the format of {id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}.

+

type is one of the Config.Tools constants.

+

screenRect was formerly called rect.

+ + +
+ + + + + + +
Example
+ +
this._viewer.getAnnotationListAt(0, 0, 200, 200).then((annotations) => {
+  for (const annotation of annotations) {
+    console.log('Annotation found at line has id:', annotation.id);
+  }
+})
+ + + +
+ + + +
+ + +
+

getAnnotationsOnPage

+ + +
+
+ + +
+

Gets the list of annotations on a given page.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2686 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageNumber + + +integer + + + + +

the page number where annotations are located. It is 1-indexed

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotations + + +Promise<(void|Array<object>)> + + + + + + + list of annotations on the target page, +each in the format of {id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}.

+

type is one of the Config.Tools constants.

+

screenRect was formerly called rect.

+ + +
+ + + + + + +
Example
+ +
this._viewer.getAnnotationsOnPage(2).then((annotations) => {
+  for (const annotation of annotations) {
+    console.log('Annotation found on page 2 has id:', annotation.id);
+  }
+})
+ + + +
+ + + +
+ + +
+

getCustomDataForAnnotation

+ + +
+
+ + +
+

Gets an annotation's customData property.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2713 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotationId + + +string + + + + +

the unique id of the annotation

pageNumber + + +integer + + + + +

the page number where annotation is located. It is 1-indexed

key + + +string + + + + +

the unique key associated with the customData property

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +Promise<(void|string)> + + + + + + + the customData property associated +with the given key

+ + +
+ + + + + + +
Example
+ +
this._viewer.setPropertiesForAnnotation("annotation1", 2, {
+  customData: {
+    data: "Nice annotation"
+  }
+}).then(() => {
+  this._viewer.getCustomDataForAnnotation("annotation1", 2, "data").then((value) => {
+    console.log(value === "Nice annotation");
+  })
+})
+ + + +
+ +
+

Bookmark


+ + + +
+

importBookmarkJson

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2102 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bookmarkJson + + +string + + + + +

needs to be in valid bookmark JSON format, +for example {"0": "Page 1"}. The page numbers are 1-indexed

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.importBookmarkJson("{\"0\": \"Page 1\", \"3\": \"Page 4\"}");
+ + + +
+ + + +
+ + +
+

openBookmarkList

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2118 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.openBookmarkList();
+ + + +
+ +
+

Canvas


+ + + +
+

getCanvasSize

+ + +
+
+ + +
+

Returns the canvas size of current document viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3039 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + +Promise<(void|object)> + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
widthnumbercurrent width of canvas
heightnumbercurrent height of canvas
+ + +
+ + + + + + +
Example
+ +
this._viewer.getCanvasSize().then(({width, height}) => {
+  console.log('Current canvas width is:', width);
+  console.log('Current canvas height is:', height);
+});
+ + + +
+ +
+

Coordinate


+ + + +
+

convertScreenPointsToPagePoints

+ + +
+
+ + +
+

Converts points from screen coordinates to page coordinates in the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3113 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
points + + +Array<object> + + + + +

list of points, each in the format {x: number, y: number}. +You could optionally have a pageNumber: number in the object. +Without specifying, the page system is referring to the current page

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
convertedPoints + + +Promise<(void|Array<object>)> + + + + + + + list of converted points in page system, +each in the format {x: number, y: number}. It would be empty if conversion is unsuccessful

+ + +
+ + + + + + +
Example
+ +
// convert (50, 50) and (100, 100) from screen system to page system,
+// on current page and page 1 respectively
+this._viewer.convertScreenPointsToPagePoints([{x: 50, y: 50}, {x: 100, y:100, pageNumber: 1}])
+ .then((convertedPoints) => {
+   convertedPoints.forEach(point => {
+    console.log(point);
+   })
+ });
+ + + +
+ + + +
+ + +
+

convertPagePointsToScreenPoints

+ + +
+
+ + +
+

Converts points from page coordinates to screen coordinates in the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3139 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
points + + +Array<object> + + + + +

list of points, each in the format {x: number, y: number}. +You could optionally have a pageNumber: number in the object. +Without specifying, the page system is referring to the current page

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
convertedPoints + + +Promise<(void|Array<object>)> + + + + + + + list of converted points in +screen system, each in the format {x: number, y: number}. +It would be empty if conversion is unsuccessful

+ + +
+ + + + + + +
Example
+ +
// convert (50, 50) on current page and (100, 100) on page 1 from page system to screen system
+this._viewer.convertPagePointsToScreenPoints([{x: 50, y: 50}, {x: 100, y:100, pageNumber: 1}])
+ .then((convertedPoints) => {
+   convertedPoints.forEach(point => {
+    console.log(point);
+   })
+ });
+ + + +
+ + + +
+ + +
+

getPageNumberFromScreenPoint

+ + +
+
+ + +
+

Returns the page number that contains the point on screen.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3158 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +

the x-coordinate of the screen point

y + + +number + + + + +

the y-coordinate of the screen point

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageNumber + + +Promise<(void|number)> + + + + + + + the page number of the screen point

+ + +
+ + + + + + +
Example
+ +
this._viewer.getPageNumberFromScreenPoint(10.0,50.5).then((pageNumber) => {
+  console.log('The page number of the screen point is', pageNumber);
+});
+ + + +
+ +
+

Document


+ + + +
+

getDocumentPath

+ + +
+
+ + +
+

Returns the path of the current document. +If isBase64String is true, +this would be the path to the temporary pdf file converted from +the base64 string in document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2031 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +Promise<(void|string)> + + + + + + + the document path.

+ + +
+ + + + + + +
Example
+ +
this._viewer.getDocumentPath().then((path) => {
+  console.log('The path to current document is: ' + path);
+});
+ + + +
+ + + +
+ + +
+

saveDocument

+ + +
+
+ + +
+

Saves the current document. +If isBase64String is true, +this would be the base64 string encoded from the temporary pdf file, +which is created from the base64 string in document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2260 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
filePath + + +Promise<(void|string)> + + + + + + + the location of the saved document, +or the base64 string of the pdf in the case of base64

+ + +
+ + + + + + +
Example
+ +
this._viewer.saveDocument().then((filePath) => {
+  console.log('saveDocument:', filePath);
+});
+ + + +
+ +
+

Import/Export Annotations


+ + + +
+

importAnnotationCommand

+ + +
+
+ + +
+

Imports remote annotation command to local document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2142 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
xfdfCommand + + +string + + + + + + + + + + + + +

the XFDF command string

initialLoad + + +boolean + + + + + + + <optional>
+ + + + + +
+ + false + +

whether this is for initial load.

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
const 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>';
+this._viewer.importAnnotationCommand(xfdfCommand);
+ + + +
+ + + +
+ + +
+

importAnnotations

+ + +
+
+ + +
+

Imports XFDF annotation string to the current document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2168 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
xfdf + + +string + + + + +

annotation string in XFDF format for import

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
const 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>';
+this._viewer.importAnnotations(xfdf);
+ + + +
+ + + +
+ + +
+

exportAnnotations

+ + +
+
+ + +
+

Extracts XFDF from the current document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2194 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + +object + + + + +

key: annotList, type: array. +If specified, annotations with the matching id and pageNumber will be exported; +otherwise, all annotations in the current document will be exported.

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
xfdf + + +Promise<(void|string)> + + + + + + + annotation string in XFDF format

+ + +
+ + + + + + +
Examples
+ +

Without options:

+ +
this._viewer.exportAnnotations().then((xfdf) => {
+  console.log('XFDF for all annotations:', xfdf);
+});
+ +

With options:

+ +
// annotList is an array of annotation data in the format {id: string, pageNumber: int}
+const annotations = [{id: 'annot1', pageNumber: 1}, {id: 'annot2', pageNumber: 3}];
+this._viewer.exportAnnotations({annotList: annotations}).then((xfdf) => {
+  console.log('XFDF for 2 specified annotations', xfdf);
+});
+ + + +
+ +
+

Multi-tab


+ + + +
+

closeAllTabs

+ + +
+
+ + +
+

Closes all tabs in a multi-tab environment.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2884 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
// Do this only when DocumentView has multiTabEnabled = true
+this._viewer.closeAllTabs();
+ + + +
+ + + +
+ + +
+

openTabSwitcher

+ + +
+
+ + +
+

Opens the tab switcher in a multi-tab environment.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2900 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
// Do this only when DocumentView has multiTabEnabled = true
+this._viewer.openTabSwitcher();
+ + + +
+ +
+

Navigation


+ + + +
+

handleBackButton

+ + +
+
+ + +
+

Handles the back button in search mode. Android only.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2373 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
handled + + +Promise<(void|boolean)> + + + + + + + whether the back button is handled successfully

+ + +
+ + + + + + +
Example
+ +
this._viewer.handleBackButton().then((handled) => {
+  if (!handled) {
+    BackHandler.exitApp();
+  }
+});
+ + + +
+ +
+

Other


+ + + +
+

exportAsImage

+ + +
+
+ + +
+

Export a PDF page to image format defined in Config.ExportFormat.

+

Unlike RNPdftron.exportAsImage, +this is a viewer method and should only be called after the document has been +loaded or else unexpected behaviour can occur. +This method uses the PDF that is associated with the viewer, +and does not take a local file path to the desired PDF.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3598 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageNumber + + +int + + + + +

the page to be converted; +if the value does not refer to a valid page number, the file path will be undefined

dpi + + +double + + + + +

the output image resolution

exportFormat + + +Config.ExportFormat + + + + +

image format to be exported to

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +Promise<(void|string)> + + + + + + + the temp path of the created image, +user is responsible for clean up the cache

+ + +
+ + + + + + +
Example
+ +
this._viewer.exportToImage(1, 92, Config.ExportFormat.BMP).then((path) => {
+  console.log('export', path);
+});
+ + + +
+ + + +
+ + +
+

showCrop

+ + +
+
+ + +
+

Displays the page crop option. Android only.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3678 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.showCrop();
+ + + +
+ + + +
+ + +
+

showViewSettings

+ + +
+
+ + +
+

Displays the view settings.

+

Requires a source rect in screen co-ordinates. +On iOS this rect will be the anchor point for the view. The rect is ignored on Android.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3717 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rect + + +map + + + + +

The rectangular area in screen co-ordinates with keys +x1 (left), y1 (bottom), y1 (right), y2 (top). Coordinates are in double format.

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.showViewSettings({'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0});
+ + + +
+ + + +
+ + +
+

showAddPagesView

+ + +
+
+ + +
+

Displays the add pages view.

+

Requires a source rect in screen co-ordinates. +On iOS this rect will be the anchor point for the view. The rect is ignored on Android.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3755 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rect + + +map + + + + +

The rectangular area in screen co-ordinates with keys +x1 (left), y1 (bottom), y1 (right), y2(top). Coordinates are in double format.

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.showAddPagesView({'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0});
+ + + +
+ + + +
+ + +
+

shareCopy

+ + +
+
+ + +
+

Displays the share copy view.

+

Requires a source rect in screen co-ordinates. +On iOS this rect will be the anchor point for the view. The rect is ignored on Android.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3807 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rect + + +map + + + + +

The rectangular area in screen co-ordinates with keys +x1 (left), y1 (bottom), y1 (right), y2 (top). Coordinates are in double format.

flattening + + +boolean + + + + +

Whether the shared copy should be flattened before sharing.

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.shareCopy({'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0}, true);
+ + + +
+ + + +
+ + +
+

openOutlineList

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3842 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.openOutlineList();
+ + + +
+ + + +
+ + +
+

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.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3858 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.openLayersList();
+ + + +
+ + + +
+ + +
+

openNavigationLists

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3872 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.openNavigationLists();
+ + + +
+ +
+

Page


+ + + +
+

getPageCount

+ + +
+
+ + +
+

Gets the current page count of the document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2084 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageCount + + +Promise<(void|number)> + + + + + + + the current page count of the document

+ + +
+ + + + + + +
Example
+ +
this._viewer.getPageCount().then((pageCount) => {
+  console.log('pageCount', pageCount);
+});
+ + + +
+ + + +
+ + +
+

getPageCropBox

+ + +
+
+ + +
+

Gets the crop box for specified page as a JSON object.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2734 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageNumber + + +integer + + + + +

the page number for the target crop box. It is 1-indexed

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cropBox + + +Promise<(void|object)> + + + + + + + an object with information about position +(x1, y1, x2 and y2) and size (width and height)

+ + +
+ + + + + + +
Example
+ +
this._viewer.getPageCropBox(1).then((cropBox) => {
+  console.log('bottom-left coordinate:', cropBox.x1, cropBox.y1);
+  console.log('top-right coordinate:', cropBox.x2, cropBox.y2);
+  console.log('width and height:', cropBox.width, cropBox.height);
+});
+ + + +
+ + + +
+ + +
+

setCurrentPage

+ + +
+
+ + +
+

Sets current page of the document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2754 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageNumber + + +integer + + + + +

the page number to be set as the current page; 1-indexed

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +Promise<(void|boolean)> + + + + + + + whether the setting process was successful

+ + +
+ + + + + + +
Example
+ +
this._viewer.setCurrentPage(4).then((success) => {
+  if (success) {
+    console.log("Current page is set to 4.");
+  }
+});
+ + + +
+ + + +
+ + +
+

getVisiblePages

+ + +
+
+ + +
+

Gets the visible pages in the current viewer as an array.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2774 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
visiblePages + + +Promise<(void|Array<number>)> + + + + + + + a list of visible pages in the +current viewer

+ + +
+ + + + + + +
Example
+ +
this._viewer.getVisiblePages().then((visiblePages) => {
+  for (const page of visiblePages) {
+    console.log('page', page, 'is visible.')
+  }
+});
+ + + +
+ + + +
+ + +
+

gotoPreviousPage

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2794 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +Promise<(void|boolean)> + + + + + + + whether the setting process was successful +(no change due to staying in first page counts as being successful)

+ + +
+ + + + + + +
Example
+ +
this._viewer.gotoPreviousPage().then((success) => {
+  if (success) {
+    console.log("Go to previous page.");
+  }
+});
+ + + +
+ + + +
+ + +
+

gotoNextPage

+ + +
+
+ + +
+

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

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2814 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +Promise<(void|boolean)> + + + + + + + whether the setting process was successful +(no change due to staying in last page counts as being successful)

+ + +
+ + + + + + +
Example
+ +
this._viewer.gotoNextPage().then((success) => {
+  if (success) {
+    console.log("Go to next page.");
+  }
+});
+ + + +
+ + + +
+ + +
+

gotoFirstPage

+ + +
+
+ + +
+

Go to the first page of the document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2833 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +Promise<(void|boolean)> + + + + + + + whether the setting process was successful

+ + +
+ + + + + + +
Example
+ +
this._viewer.gotoFirstPage().then((success) => {
+  if (success) {
+    console.log("Go to first page.");
+  }
+});
+ + + +
+ + + +
+ + +
+

gotoLastPage

+ + +
+
+ + +
+

Go to the last page of the document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2852 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +Promise<(void|boolean)> + + + + + + + whether the setting process was successful

+ + +
+ + + + + + +
Example
+ +
this._viewer.gotoLastPage().then((success) => {
+  if (success) {
+    console.log("Go to last page.");
+  }
+});
+ + + +
+ + + +
+ + +
+

showGoToPageView

+ + +
+
+ + +
+

Opens a go-to page dialog. If the user inputs a valid page number into the dialog, +the viewer will go to that page.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2868 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.showGoToPageView();
+ + + +
+ + + +
+ + +
+

getPageRotation

+ + +
+
+ + +
+

Gets the rotation value of all pages in the current document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3057 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageRotation + + +Promise<(void|number)> + + + + + + + the rotation degree of all pages, +one of 0, 90, 180 or 270 (clockwise).

+ + +
+ + + + + + +
Example
+ +
this._viewer.getPageRotation().then((pageRotation) => {
+  console.log('The current page rotation degree is' + pageRotation);
+});
+ + + +
+ + + +
+ + +
+

rotateClockwise

+ + +
+
+ + +
+

Rotates all pages in the current document in clockwise direction (by 90 degrees).

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3072 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.rotateClockwise();
+ + + +
+ + + +
+ + +
+

rotateCounterClockwise

+ + +
+
+ + +
+

Rotates all pages in the current document in counter-clockwise direction (by 90 degrees).

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3087 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.rotateCounterClockwise();
+ + + +
+ + + +
+ + +
+

showRotateDialog

+ + +
+
+ + +
+

Android only.

+

Displays a rotate dialog. +This dialog allows users to rotate pages of the opened document by 90, 180 and 270 degrees. +It also displays a thumbnail of the current page at the selected rotation angle.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3736 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.showRotateDialog();
+ + + +
+ +
+

Reflow


+ + + +
+

isReflowMode

+ + +
+
+ + +
+

Returns whether the viewer is currently in reflow mode.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3772 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
inReflow + + +Promise<(void|boolean)> + + + + + + + whether the viewer is in reflow mode

+ + +
+ + + + + + +
Example
+ +
this._viewer.isReflowMode().then((inReflow) => {
+  console.log(inReflow ? 'in reflow mode' : 'not in reflow mode');
+});
+ + + +
+ + + +
+ + +
+

toggleReflow

+ + +
+
+ + +
+

Allows the user to programmatically enter and exit reflow mode.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3787 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.toggleReflow();
+ + + +
+ +
+

Rendering Options


+ + + +
+

setProgressiveRendering

+ + +
+
+ + +
+

Sets whether the control will render progressively +or will just draw once the entire view has been rendered.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3179 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
progressiveRendering + + +boolean + + + + +

whether to render progressively

initialDelay + + +number + + + + +

delay before the progressive rendering timer is started, +in milliseconds

interval + + +number + + + + +

delay between refreshes, in milliseconds

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
// delay for 10s before start, and refresh every 1s
+this._viewer.setProgressiveRendering(true, 10000, 1000);
+ + + +
+ + + +
+ + +
+

setImageSmoothing

+ + +
+
+ + +
+

Enables or disables image smoothing. +The rasterizer allows a trade-off between rendering quality and rendering speed. +This function can be used to indicate the preference between rendering speed and quality.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3197 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
imageSmoothing + + +boolean + + + + +

whether to enable image smoothing

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.setImageSmoothing(false);
+ + + +
+ + + +
+ + +
+

setOverprint

+ + +
+
+ + +
+

Enables or disables support for overprint and overprint simulation. +Overprint is a device dependent feature and the results will vary depending +on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc).

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3215 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
overprint + + +Config.OverprintMode + + + + +

the mode of overprint

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.setOverprint(Config.OverprintMode.Off);
+ + + +
+ +
+

Scroll


+ + + +
+

getScrollPos

+ + +
+
+ + +
+

Returns the horizontal and vertical scroll position of current document viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3015 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + +Promise<(void|object)> + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
horizontalnumbercurrent horizontal scroll position
verticalnumbercurrent vertical scroll position
+ + +
+ + + + + + +
Example
+ +
this._viewer.getScrollPos().then(({horizontal, vertical}) => {
+  console.log('Current horizontal scroll position is:', horizontal);
+  console.log('Current vertical scroll position is:', vertical);
+});
+ + + +
+ +
+

Signature


+ + + +
+

getSavedSignatures

+ + +
+
+ + +
+

Gets a list of absolute file paths to PDFs containing the saved signatures.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3894 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
signatures + + +Promise<(void|Array<string>)> + + + + + + + an array of string containing the +absolute file paths; if there are no saved signatures, the value is an empty array

+ + +
+ + + + + + +
Example
+ +
this._viewer.getSavedSignatures().then((signatures) => {
+  if (signatures.length > 0) {
+    signatures.forEach((signature) => {
+      console.log(signature);
+    });
+  }
+})
+ + + +
+ + + +
+ + +
+

getSavedSignatureFolder

+ + +
+
+ + +
+

Retrieves the absolute file path to the folder containing the saved signatures. +For Android, to get the folder containing the saved signature JPGs, use +getSavedSignatureJpgFolder.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3915 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +Promise<(void|string)> + + + + + + + the absolute file path to the folder

+ + +
+ + + + + + +
Example
+ +
this._viewer.getSavedSignatureFolder().then((path) => {
+  if (path != null) {
+    console.log(path);
+  }
+})
+ + + +
+ + + +
+ + +
+

getSavedSignatureJpgFolder

+ + +
+
+ + +
+

Android only.

+

Retrieves the absolute file path to the folder containing the saved signature JPGs. +For Android, to get the folder containing the saved signature PDFs, use +getSavedSignatureFolder.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3938 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +Promise<(void|string)> + + + + + + + the absolute file path to the folder

+ + +
+ + + + + + +
Example
+ +
this._viewer.getSavedSignatureJpgFolder().then((path) => {
+  if (path != null) {
+    console.log(path);
+  }
+})
+ + + +
+ +
+

Text Selection


+ + + +
+

startSearchMode

+ + +
+
+ + +
+

Search for a term and all matching results will be highlighted.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3271 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
searchString + + +string + + + + +

the text to search for

matchCase + + +boolean + + + + +

indicates if it is case sensitive

matchWholeWord + + +boolean + + + + +

indicates if it matches an entire word only

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.startSearchMode('PDFTron', false, false);
+ + + +
+ + + +
+ + +
+

exitSearchMode

+ + +
+
+ + +
+

Finishes the current text search and remove all the highlights.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3286 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.exitSearchMode();
+ + + +
+ + + +
+ + +
+

findText

+ + +
+
+ + +
+

Searches asynchronously, starting from the current page, for the given text. +PDFViewCtrl automatically scrolls to the position so that the found text is visible.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3307 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
searchString + + +string + + + + +

the text to search for

matchCase + + +boolean + + + + +

indicates if it is case sensitive

matchWholeWord + + +boolean + + + + +

indicates if it matches an entire word only

searchUp + + +boolean + + + + +

indicates if it searches upward

regExp + + +boolean + + + + +

indicates if searchString is a regular expression

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.findText('PDFTron', false, false, true, false);
+ + + +
+ + + +
+ + +
+

cancelFindText

+ + +
+
+ + +
+

Cancels the current text search thread, if exists.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3322 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.cancelFindText();
+ + + +
+ + + +
+ + +
+

openSearch

+ + +
+
+ + +
+

Displays a search bar that allows the user to enter and search text within a document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3337 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.openSearch();
+ + + +
+ + + +
+ + +
+

getSelection

+ + +
+
+ + +
+

Returns the text selection on a given page, if any.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3374 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageNumber + + +number + + + + +

the specified page number. It is 1-indexed

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
selection + + +Promise<(void|object)> + + + + + + + the text selection, in the format +{html: string, unicode: string, pageNumber: number, quads: [[{x: number, y: number}, {x: number, y: number}, {x: number, y: number}, {x: number, y: number}], ...]}. +If no such selection could be found, this would be null

+

Quads indicate the quad boundary boxes for the selection, +which could have a size larger than 1 if selection spans across different lines. +Each quad have 4 points with x, y coordinates specified in number, representing a boundary box. +The 4 points are in counter-clockwise order, though the first point is not guaranteed to be on +lower-left relatively to the box.

+ + +
+ + + + + + +
Example
+ +
this._viewer.getSelection(2).then((selection) => {
+  if (selection) {
+    console.log('Found selection on page', selection.pageNumber);
+    for (let i = 0; i < selection.quads.length; i ++) {
+      const quad = selection.quads[i];
+      console.log('selection boundary quad', i);
+      for (const quadPoint of quad) {
+        console.log('A quad point has coordinates', quadPoint.x, quadPoint.y);
+      }
+    }
+  }
+});
+ + + +
+ + + +
+ + +
+

hasSelection

+ + +
+
+ + +
+

Returns whether there is a text selection in the current document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3391 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hasSelection + + +Promise<(void|boolean)> + + + + + + + whether a text selection exists

+ + +
+ + + + + + +
Example
+ +
this._viewer.hasSelection().then((hasSelection) => {
+  console.log('There is a selection in the document.');
+});
+ + + +
+ + + +
+ + +
+

clearSelection

+ + +
+
+ + +
+

Clears any text selection in the current document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3406 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.clearSelection();
+ + + +
+ + + +
+ + +
+

getSelectionPageRange

+ + +
+
+ + +
+

Returns the page range (beginning and end) that has text selection on it.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3433 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + +Promise<(void|object)> + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
beginnumberthe first page to have selection, -1 if there are no selections
endnumberthe last page to have selection, -1 if there are no selections
+ + +
+ + + + + + +
Example
+ +
this._viewer.getSelectionPageRange().then(({begin, end}) => {
+  if (begin === -1) {
+    console.log('There is no selection');
+  } else {
+    console.log('The selection range is from', begin, 'to', end);
+  }
+});
+ + + +
+ + + +
+ + +
+

hasSelectionOnPage

+ + +
+
+ + +
+

Returns whether there is a text selection on the specified page in the current document.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3454 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageNumber + + +number + + + + +

the specified page number. It is 1-indexed

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hasSelection + + +Promise<(void|boolean)> + + + + + + + whether a text selection exists on +the specified page

+ + +
+ + + + + + +
Example
+ +
this._viewer.hasSelectionOnPage(5).then((hasSelection) => {
+  if (hasSelection) {
+    console.log('There is a selection on page 5 in the document.');
+  }
+});
+ + + +
+ + + +
+ + +
+

selectInRect

+ + +
+
+ + +
+

Selects the text within the given rectangle region.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3473 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rect + + +object + + + + +

the rectangle region in the format of +{x1: number, x2: number, y1: number, y2: number}

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
selected + + +Promise<(void|boolean)> + + + + + + + whether there is text selected

+ + +
+ + + + + + +
Example
+ +
this._viewer.selectInRect({x1: 0, y1: 0, x2: 200.5, y2: 200.5}).then((selected) => {
+        console.log(selected);
+});
+ + + +
+ + + +
+ + +
+

isThereTextInRect

+ + +
+
+ + +
+

Returns whether there is text in given rectangle region.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3492 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rect + + +object + + + + +

the rectangle region in the format of +{x1: number, x2: number, y1: number, y2: number}

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hasText + + +Promise<(void|boolean)> + + + + + + + whether there is text in the region

+ + +
+ + + + + + +
Example
+ +
this._viewer.isThereTextInRect({x1: 0, y1: 0, x2: 200, y2: 200}).then((hasText) => {
+        console.log(hasText);
+});
+ + + +
+ + + +
+ + +
+

selectAll

+ + +
+
+ + +
+

Selects all text on the page.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3507 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.selectAll();
+ + + +
+ +
+

Thumbnails


+ + + +
+

openThumbnailsView

+ + +
+
+ + +
+

Display a page thumbnails view.

+

This view allows users to navigate pages of a document. +If thumbnailViewEditingEnabled is true, +the user can also manipulate the document, including add, remove, re-arrange, rotate and +duplicate pages.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3827 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.openThumbnailsView();
+ + + +
+ +
+

Toolbar


+ + + +
+

setCurrentToolbar

+ + +
+
+ + +
+

Sets the current annotationToolbars +for the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3698 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
toolbar + + +Config.DefaultToolbars +| + +string + + + + +

the toolbar to enable. Should be one of the +Config.DefaultToolbars constants or the id of a custom toolbar object.

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.setCurrentToolbar(Config.DefaultToolbars.Insert).then(() => {
+  // done switching toolbar
+});
+ + + +
+ +
+

UI Customization


+ + + +
+

setColorPostProcessMode

+ + +
+
+ + +
+

Sets the color post processing transformation mode for the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3231 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
colorPostProcessMode + + +Config.ColorPostProcessMode + + + + +

color post processing +transformation mode

+ + + + + + + + + + + + + + + + +
Example
+ +
this._viewer.setColorPostProcessMode(Config.ColorPostProcessMode.NightMode);
+ + + +
+ + + +
+ + +
+

setColorPostProcessColors

+ + +
+
+ + +
+

Sets the white and black color for the color post processing transformation.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3253 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
whiteColor + + +object + + + + +

the white color for the color post processing transformation, +in the format {red: number, green: number, blue: number}. +alpha could be optionally included (only Android would apply alpha), +and all numbers should be in range [0, 255]

blackColor + + +object + + + + +

the black color for the color post processing transformation, +in the same format as whiteColor

+ + + + + + + + + + + + + + + + +
Example
+ +
const whiteColor = {"red": 0, "green": 0, "blue": 255};
+const blackColor = {"red": 255, "green": 0, "blue": 0};
+this._viewer.setColorPostProcessColors(whiteColor, blackColor);
+ + + +
+ +
+

Undo/Redo


+ + + +
+

undo

+ + +
+
+ + +
+

Undo the last modification.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3613 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.undo();
+ + + +
+ + + +
+ + +
+

redo

+ + +
+
+ + +
+

Redo the last modification.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3628 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.redo();
+ + + +
+ + + +
+ + +
+

canUndo

+ + +
+
+ + +
+

Checks whether an undo operation can be performed from the current snapshot.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3646 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
canUndo + + +Promise<(void|boolean)> + + + + + + + whether it is possible to undo from +the current snapshot

+ + +
+ + + + + + +
Example
+ +
this._viewer.canUndo().then((canUndo) => {
+  console.log(canUndo ? 'undo possible' : 'no action to undo');
+});
+ + + +
+ + + +
+ + +
+

canRedo

+ + +
+
+ + +
+

Checks whether a redo operation can be perfromed from the current snapshot.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3664 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
canRedo + + +Promise<(void|boolean)> + + + + + + + whether it is possible to redo from +the current snapshot

+ + +
+ + + + + + +
Example
+ +
this._viewer.canRedo().then((canRedo) => {
+  console.log(canRedo ? 'redo possible' : 'no action to redo');
+});
+ + + +
+ +
+

Viewer Options


+ + + +
+

setPageBorderVisibility

+ + +
+
+ + +
+

Sets whether borders of each page are visible in the viewer, +which is disabled by default.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3523 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageBorderVisibility + + +boolean + + + + +

whether borders of each page are visible in the viewer

+ + + + + + + + + + + + + + + + +
Example
+ +
this._viewer.setPageBorderVisibility(true);
+ + + +
+ + + +
+ + +
+

setPageTransparencyGrid

+ + +
+
+ + +
+

Enables or disables transparency grid (check board pattern) to reflect page transparency, +which is disabled by default.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3539 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageTransparencyGrid + + +boolean + + + + +

whether to use the transparency grid

+ + + + + + + + + + + + + + + + +
Example
+ +
this._viewer.setPageTransparencyGrid(true);
+ + + +
+ + + +
+ + +
+

setDefaultPageColor

+ + +
+
+ + +
+

Sets the default page color of the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3555 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
defaultPageColor + + +object + + + + +

the default page color, in the format +{red: number, green: number, blue: number}, each number in range [0, 255]

+ + + + + + + + + + + + + + + + +
Example
+ +
this._viewer.setDefaultPageColor({red: 0, green: 255, blue: 0}); // green color
+ + + +
+ + + +
+ + +
+

setBackgroundColor

+ + +
+
+ + +
+

Sets the background color of the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 3571 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
backgroundColor + + +object + + + + +

the background color, in the format +{red: number, green: number, blue: number}, each number in range [0, 255]

+ + + + + + + + + + + + + + + + +
Example
+ +
this._viewer.setBackgroundColor({red: 0, green: 0, blue: 255}); // blue color
+ + + +
+ +
+

Zoom


+ + + +
+

getZoom

+ + +
+
+ + +
+

Returns the current zoom scale of current document viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2917 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
zoom + + +Promise<(void|number)> + + + + + + + current zoom scale in the viewer

+ + +
+ + + + + + +
Example
+ +
this._viewer.getZoom().then((zoom) => {
+  console.log('Zoom scale of the current document is:', zoom);
+});
+ + + +
+ + + +
+ + +
+

setZoomLimits

+ + +
+
+ + +
+

Sets the minimum and maximum zoom bounds of current viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2936 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
zoomLimitMode + + +Config.ZoomLimitMode + + + + +

defines whether bounds are relative to the +standard zoom scale in the current viewer or absolute

minimum + + +double + + + + +

the lower bound of the zoom limit range

maximum + + +double + + + + +

the upper bound of the zoom limit range

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.setZoomLimits(Config.ZoomLimitMode.Absolute, 1.0, 3.5);
+ + + +
+ + + +
+ + +
+

zoomWithCenter

+ + +
+
+ + +
+

Sets the zoom scale in the current document viewer with a zoom center.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2954 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
zoom + + +double + + + + +

the zoom ratio to be set

x + + +int + + + + +

the x-coordinate of the zoom center

y + + +int + + + + +

the y-coordinate of the zoom center

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.zoomWithCenter(3.0, 100, 300);
+ + + +
+ + + +
+ + +
+

zoomToRect

+ + +
+
+ + +
+

Zoom the viewer to a specific rectangular area in a page.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2972 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageNumber + + +int + + + + +

the page number of the zooming area (1-indexed)

rect + + +object + + + + +

The rectangular area with keys +x1 (left), y1 (bottom), y1 (right), y2 (top). Coordinates are in double

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.zoomToRect(3, {'x1': 1.0, 'y1': 2.0, 'x2': 3.0, 'y2': 4.0});
+ + + +
+ + + +
+ + +
+

smartZoom

+ + +
+
+ + +
+

Zoom to a paragraph that contains the specified coordinate. +If no paragraph contains the coordinate, the zooming would not happen.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Source: + DocumentView.js + + line 2991 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +int + + + + +

the x-coordinate of the target coordinate

y + + +int + + + + +

the y-coordinate of the target coordinate

animated + + +boolean + + + + +

whether the transition is animated

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
this._viewer.smartZoom(100, 200, true);
+ + + +
+ +
+ + + + + +

Events

+ +
+

Annotation Menu


+ + + +
+

onAnnotationMenuPress

+ + +
+
+ + +
+

This function is called when an annotation menu item passed in to +overrideAnnotationMenuBehavior is pressed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 423 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotationMenu + + +Config.AnnotationMenu + + + + +

the menu item that has been pressed.

annotations + + +Array<object> + + + + +

An array of +{id: string, pageNumber: number, type: string, screenRect: object, pageRect: object} objects.

+

id is the annotation identifier and type is one of the Config.Tools constants.

+

screenRect was formerly called rect.

+

Both rects are represented with +{x1: number, y1: number, x2: number, y2: number, width: number, height: number} objects.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onAnnotationMenuPress = {({annotationMenu, annotations}) => {
+    console.log('Annotation menu item', annotationMenu, 'has been pressed');
+    annotations.forEach(annotation => {
+      console.log('The id of selected annotation is', annotation.id);
+      console.log('The page number of selected annotation is', annotation.pageNumber);
+      console.log('The type of selected annotation is', annotation.type);
+      console.log('The screenRect of selected annotation is', annotation.screenRect);
+      console.log('The pageRect of selected annotation is', annotation.pageRect);
+    });
+  }}
+/>
+ + + +
+ +
+

Annotations


+ + + +
+

onAnnotationsSelected

+ + +
+
+ + +
+

This function is called when an annotation(s) is selected.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 606 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotations + + +Array<object> + + + + +

array of annotation data in the format +{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}, +representing the selected annotations.

+

type is one of the Config.Tools constants.

+

screenRect was formerly called rect.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onAnnotationsSelected = {({annotations}) => {
+    annotations.forEach(annotation => {
+      console.log('The id of selected annotation is', annotation.id);
+      console.log('It is in page', annotation.pageNumber);
+      console.log('Its type is', annotation.type);
+    });
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onAnnotationChanged

+ + +
+
+ + +
+

This function is called if a change has been made to an annotation(s) +in the current document.

+

Note: When an annotation is flattened, it also gets deleted, so both +onAnnotationChanged and +onAnnotationFlattened are called.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 638 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
action + + +string + + + + +

the action that occurred (add, delete, modify)

annotations + + +Array<object> + + + + +

array of annotation data in the format +{id: string, pageNumber: number, type: string}, +representing the annotations that have been changed.

+

type is one of the Config.Tools constants

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onAnnotationChanged = {({action, annotations}) => {
+    console.log('Annotation edit action is', action);
+    annotations.forEach(annotation => {
+      console.log('The id of changed annotation is', annotation.id);
+      console.log('It is in page', annotation.pageNumber);
+      console.log('Its type is', annotation.type);
+    });
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onFormFieldValueChanged

+ + +
+
+ + +
+

This function is called if a change has been made to form field values.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 660 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fields + + +Array<object> + + + + +

array of field data in the format +{fieldName: string, fieldType: string, fieldValue: any}, +representing the fields that have been changed

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onFormFieldValueChanged = {({fields}) => {
+    fields.forEach(field => {
+      console.log('The name of the changed field is', field.fieldName);
+      console.log('The type of the changed field is', field.fieldType);
+      console.log('The value of the changed field is', field.fieldValue);
+    });
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onAnnotationFlattened

+ + +
+
+ + +
+

This function is called if an annotation(s) has been flattened in the +current document.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 687 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotations + + +Array<object> + + + + +

array of annotation data in the format +{id: string, pageNumber: number, type: string}, +representing the annotations that have been changed.

+

type is one of the Config.Tools constants

+

id returned via the event listener can be null.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onAnnotationFlattened={({annotations}) => {
+          annotations.forEach(annotation => {
+            console.log('The id of changed annotation is', annotation.id);
+            console.log('It is in page', annotation.pageNumber);
+            console.log('Its type is', annotation.type);
+          });
+        }}
+/>
+ + + +
+ +
+

Bookmark


+ + + +
+

onBookmarkChanged

+ + +
+
+ + +
+

This function is called if a change has been made to user bookmarks.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1196 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bookmarkJson + + +string + + + + +

the list of current bookmarks in JSON format

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onBookmarkChanged = {({bookmarkJson}) => {
+    console.log('Bookmarks have been changed. Current bookmark collection is', bookmarkJson);
+  }}
+/>
+ + + +
+ +
+

Custom Behavior


+ + + +
+

onBehaviorActivated

+ + +
+
+ + +
+

This function is called if the activated behavior is passed in to +overrideBehavior

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 485 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
action + + +Config.Actions + + + + +

the action which has been activated.

data + + +object + + + + +

A JSON object that varies depending on the action.

+

If action is Config.Actions.linkPress, data type is {url: string}.

+

If action is Config.Actions.stickyNoteShowPopUp, data type is +{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}

+

type is one of the Config.Tools constants,

+

screenRect was formerly called rect.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onBehaviorActivated = {({action, data}) => {
+    console.log('Activated action is', action);
+    if (action === Config.Actions.linkPress) {
+      console.log('The external link pressed is', data.url);
+    } else if (action === Config.Actions.stickyNoteShowPopUp) {
+      console.log('Sticky note has been activated, but it would not show a pop up window.');
+    }
+  }}
+/>
+ + + +
+ +
+

Import/Export Annotations


+ + + +
+

onExportAnnotationCommand

+ + +
+
+ + +
+

This function is called if a change has been made to annotations in the current document. +Unlike onAnnotationChanged, this function has +an XFDF command string as its parameter. If you are modifying or deleting multiple annotations, +then on Android the function is only called once, and on iOS it is called for each annotation.

+

Known Issues

+

On iOS, there is currently a bug that prevents the last XFDF from being retrieved when +modifying annotations while collaboration mode is enabled.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 935 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
action + + +string + + + + +

the action that occurred (add, delete, modify)

xfdfCommand + + +string + + + + +

an xfdf string containing info about the edit

annotations + + +array + + + + +

an array of annotation data. +When collaboration is enabled data comes in the format {id: string}, otherwise the format is +{id: string, pageNumber: number, type: string}. +In both cases, the data represents the annotations that have been changed.

+

type is one of the Config.Tools constants.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onExportAnnotationCommand = {({action, xfdfCommand, annotations}) => {
+    console.log('Annotation edit action is', action);
+    console.log('The exported xfdfCommand is', xfdfCommand);
+    annotations.forEach((annotation) => {
+      console.log('Annotation id is', annotation.id);
+    if (!this.state.collabEnabled) {
+        console.log('Annotation pageNumber is', annotation.pageNumber);
+        console.log('Annotation type is', annotation.type);
+      }
+    });
+    }}
+    collabEnabled={this.state.collabEnabled}
+    currentUser={'Pdftron'}
+/>
+ + + +
+ +
+

Layout


+ + + +
+

onLayoutChanged

+ + +
+
+ + +
+

This function is called when the layout of the viewer has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 756 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onLayoutChanged = {() => {
+    console.log('Layout has been updated.');
+  }}
+/>
+ + + +
+ +
+

Long Press Menu


+ + + +
+

onLongPressMenuPress

+ + +
+
+ + +
+

This function is called if the pressed long press menu item is passed in to +overrideLongPressMenuBehavior.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 347 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
longPressMenu + + +Config.LongPressMenu + + + + +

the menu item that has been pressed.

longPressText + + +string + + + + +

the selected text if pressed on text, empty otherwise

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onLongPressMenuPress = {({longPressMenu, longPressText}) => {
+    console.log('Long press menu item', longPressMenu, 'has been pressed');
+    if (longPressText !== '') {
+      console.log('The selected text is', longPressText);
+    }
+  }}
+/>
+ + + +
+ +
+

Multi-tab


+ + + +
+

onTabChanged

+ + +
+
+ + +
+

The function is activated when a tab is changed.

+

This API is meant for tab-specific changes. +If you would like to know when the document finishes loading instead, see +the onDocumentLoaded event.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1748 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
currentTab + + +string + + + + +

The file path of current tab's document

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  multiTabEnabled={true}
+  onTabChanged={({currentTab}) => {
+    console.log("The current tab is ", currentTab);
+  }}
+/>
+ + + +
+ +
+

Open a Document


+ + + +
+

onDocumentLoaded

+ + +
+
+ + +
+

This function is called when the document finishes loading.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 175 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameType
path + + +string + + + + +
+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onDocumentLoaded = {(path) => {
+    console.log('The document has finished loading:', path);
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onDocumentError

+ + +
+
+ + +
+

This function is called when document opening encounters an error.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 191 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameType
error + + +string + + + + +
+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onDocumentError = {(error) => {
+    console.log('Error occured during document opening:', error);
+  }}
+/>
+ + + +
+ +
+

Page


+ + + +
+

onPageChanged

+ + +
+
+ + +
+

This function is called when the page number has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 208 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
previousPageNumber + + +int + + + + +

the previous page number

pageNumber + + +int + + + + +

the current page number

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onPageChanged = {({previousPageNumber, pageNumber}) => {
+    console.log('Page number changes from', previousPageNumber, 'to', pageNumber);
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onPageMoved

+ + +
+
+ + +
+

This function is called when a page has been moved in the document.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1727 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
previousPageNumber + + +int + + + + +

the previous page number

pageNumber + + +int + + + + +

the current page number

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onPageMoved = {({previousPageNumber, pageNumber}) => {
+    console.log('Page moved from', previousPageNumber, 'to', pageNumber);
+  }}
+/>
+ + + +
+ +
+

Scroll


+ + + +
+

onScrollChanged

+ + +
+
+ + +
+

This function is called when the scroll position has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 226 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
horizontal + + +number + + + + +

the horizontal position of the scroll

vertical + + +number + + + + +

the vertical position of the scroll

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onScrollChanged = {({horizontal, vertical}) => {
+    console.log('Current scroll position is', horizontal,
+     'horizontally, and', vertical, 'vertically.');
+  }}
+/>
+ + + +
+ +
+

Text Selection


+ + + +
+

onTextSearchStart

+ + +
+
+ + +
+

This function is called immediately before a text search begins, +either through user actions, or function calls such as findText.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1268 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onTextSearchStart = {() => {
+    console.log('Text search has started');
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onTextSearchResult

+ + +
+
+ + +
+

This function is called after a text search is finished or canceled.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1306 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
found + + +boolean + + + + +

whether a result is found. +If false, it could be caused by not finding a matching result in the document, +invalid text input, or action cancellation +(user actions or cancelFindText)

textSelection + + +object + + + + +

the text selection, in the format +{html: string, unicode: string, pageNumber: number, quads: [[{x: number, y: number}, {x: number, y: number}, {x: number, y: number}, {x: number, y: number}], ...]}. If no such selection could be found, this would be null

+

Quads indicate the quad boundary boxes for the selection, +which could have a size larger than 1 if selection spans across different lines. +Each quad have 4 points with x, y coordinates specified in number, representing a boundary box. +The 4 points are in counter-clockwise order, though the first point is not guaranteed to be on +lower-left relatively to the box.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onTextSearchResult = {({found, textSelection}) => {
+    if (found) {
+      console.log('Found selection on page', textSelection.pageNumber);
+      for (let i = 0; i < textSelection.quads.length; i ++) {
+        const quad = textSelection.quads[i];
+        console.log('selection boundary quad', i);
+        for (const quadPoint of quad) {
+          console.log('A quad point has coordinates', quadPoint.x, quadPoint.y);
+        }
+      }
+    }
+  }}
+/>
+ + + +
+ +
+

UI Customization


+ + + +
+

onLeadingNavButtonPressed

+ + +
+
+ + +
+

This function is called when the leading navigation button is pressed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 159 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onLeadingNavButtonPressed = {() => {
+      console.log('The leading nav has been pressed');
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onToolChanged

+ + +
+
+ + +
+

This function is called when the current tool changes to a new tool

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1228 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
previousTool + + +Config.Tools +| + +string + + + + +

the previous tool +(one of the Config.Tools constants or "unknown tool"), +representing the tool before change

tool + + +Config.Tools +| + +string + + + + +

the current tool (one of the Config.Tools constants +or "unknown tool"), representing the current tool

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onToolChanged = {({previousTool, tool}) => {
+    console.log('Tool has been changed from', previousTool, 'to', tool);
+  }}
+/>
+ + + +
+ +
+

Undo/Redo


+ + + +
+

onUndoRedoStateChanged

+ + +
+
+ + +
+

This function is called when the state of the current document's +undo/redo stack has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1482 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onUndoRedoStateChanged = {() => {
+    console.log("Undo/redo stack state changed");
+  }}
+/>
+ + + +
+ +
+

Zoom


+ + + +
+

onZoomChanged

+ + +
+
+ + +
+

This function is called when the zoom scale has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 242 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
zoom + + +double + + + + +

the current zoom ratio of the document

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onZoomChanged = {(zoom) => {
+    console.log('Current zoom ratio is', zoom);
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onZoomFinished

+ + +
+
+ + +
+

This function is called when a zooming has been finished. +For example, if zoom via gesture, this is called on gesture release.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 259 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
zoom + + +double + + + + +

the current zoom ratio of the document

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onZoomFinished = {(zoom) => {
+    console.log('Current zoom ratio is', zoom);
+  }}
+/>
+ + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/RNPdftron.html b/docs/RNPdftron.html new file mode 100644 index 000000000..9513edfad --- /dev/null +++ b/docs/RNPdftron.html @@ -0,0 +1,1961 @@ + + + + + + + PDFTron React Native Interface: RNPdftron + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + +
+ +
+ +

+ RNPdftron +

+ + +
+ + +
+ +
+ + +

RNPdftron contains static methods for global library initialization, configuration, and +utility methods.

+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + +

Methods

+ +
+
+ + + +
+

initialize

+ + +
+
+ + +
+

Initializes PDFTron SDK with your PDFTron commercial license key. +You can run PDFTron in demo mode by passing an empty string.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
licenseKey + + +string + + + + +

your PDFTron license key

+ + + + + + + + + + + + + + + + + +
Example
+ +
RNPdftron.initialize('your_license_key');
+ + + +
+ + + +
+ + +
+

enableJavaScript

+ + +
+
+ + +
+

Enables JavaScript engine for PDFTron SDK, by default it is enabled.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
enabled + + +boolean + + + + +

whether to enable or disable JavaScript engine

+ + + + + + + + + + + + + + + + + +
Example
+ +
RNPdftron.enableJavaScript(true);
+ + + +
+ + + +
+ + +
+

getVersion

+ + +
+
+ + +
+

Gets the current PDFNet version.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
version + + +Promise<string> + + + + + + + current PDFNet version

+ + +
+ + + + + + +
Example
+ +
RNPdftron.getVersion().then((version) => {
+  console.log("Current PDFNet version:", version);
+});
+ + + +
+ + + +
+ + +
+

getPlatformVersion

+ + +
+
+ + +
+

Gets the version of current platform (Android/iOS).

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
platformVersion + + +Promise<string> + + + + + + + current platform version (Android/iOS)

+ + +
+ + + + + + +
Example
+ +
RNPdftron.getPlatformVersion().then((platformVersion) => {
+  console.log("App currently running on:", platformVersion);
+});
+ + + +
+ + + +
+ + +
+

getSystemFontList

+ + +
+
+ + +
+

Gets the font list available on the OS (Android only). +This is typically useful when you are mostly working with non-ascii characters in the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fontList + + +Promise<string> + + + + + + + the font list available on Android

+ + +
+ + + + + + +
Example
+ +
RNPdftron.getSystemFontList().then((fontList) => {
+  console.log("OS font list:", fontList);
+});
+ + + +
+ + + +
+ + +
+

clearRubberStampCache

+ + +
+
+ + +
+

Clear the information and bitmap cache for rubber stamps (Android only). +This is typically useful when the content of rubber stamps has been changed in the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
RNPdftron.clearRubberStampCache().then(() => {
+  console.log("Rubber stamp cache cleared");
+});
+ + + +
+ + + +
+ + +
+

encryptDocument

+ + +
+
+ + +
+

Encrypts (password-protect) a document (must be a PDF).

+

Note: This function does not lock the document, +it cannot be used while the document is opened in the viewer.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
filePath + + +string + + + + +

the local file path to the file

password + + +string + + + + +

the password you would like to set

currentPassword + + +string + + + + +

the current password, use empty string if no password

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
+ + +Promise<void> + + + + +
+ + + + + + +
Example
+ +
RNPdftron.encryptDocument("/sdcard/Download/new.pdf", "1111", "").then(() => {
+  console.log("done password");
+});
+ + + +
+ + + +
+ + +
+

pdfFromOfficeTemplate

+ + +
+
+ + +
+

Generates a PDF using a template in the form of an Office document +and replacement data in the form of a JSON object. +For more information please see our +template guide.

+

The user is responsible for cleaning up the temporary file that is generated.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
docxPath + + +string + + + + +

the local file path to the template file

json + + +object + + + + +

the replacement data in the form of a JSON object

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
resultPdfPath + + +Promise<string> + + + + + + + the local file path to the generated PDF

+ + +
+ + + + + + +
Example
+ +
RNPdftron.pdfFromOfficeTemplate("/sdcard/Download/red.docx", json).then((resultPdfPath) => {
+  console.log(resultPdfPath);
+});
+ + + +
+ + + +
+ + +
+

exportAsImage

+ + +
+
+ + +
+

Export a PDF page to an image format defined in Config.ExportFormat.

+

Unlike DocumentView.exportAsImage, +this method is static and should only be called before a DocumentView +instance has been created or else unexpected behaviour can occur. +This method also takes a local file path to the desired PDF.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pageNumber + + +int + + + + +

the page to be converted; +if the value does not refer to a valid page number, the file path will be undefined

dpi + + +double + + + + +

the output image resolution

exportFormat + + +Config.ExportFormat + + + + +

image format to be exported to

filePath + + +string + + + + +

local file path to pdf

+ + + + + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
resultImagePath + + +Promise<string> + + + + + + + the temp path of the created image, +user is responsible for clean up the cache

+ + +
+ + + + + + +
Example
+ +
RNPdftron.exportAsImage(1, 92, Config.ExportFormat.BMP, "/sdcard/Download/red.pdf").then(
+ (resultImagePath) => {
+  console.log('export', resultImagePath);
+});
+ + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/classes.list.html b/docs/classes.list.html new file mode 100644 index 000000000..a90c0e157 --- /dev/null +++ b/docs/classes.list.html @@ -0,0 +1,4460 @@ + + + + + + + PDFTron React Native Classes + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + +
+ +
+ +

+ +

+ + +
+ + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + +

Classes

+ +
+
Config
+
+ +
DocumentView
+
+ +
RNPdftron
+
+
+ + + + + + + + + + + + + +

Events

+ +
+

Annotation Menu


+ + + +
+

onAnnotationMenuPress

+ + +
+
+ + +
+

This function is called when an annotation menu item passed in to +overrideAnnotationMenuBehavior is pressed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 423 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotationMenu + + +Config.AnnotationMenu + + + + +

the menu item that has been pressed.

annotations + + +Array<object> + + + + +

An array of +{id: string, pageNumber: number, type: string, screenRect: object, pageRect: object} objects.

+

id is the annotation identifier and type is one of the Config.Tools constants.

+

screenRect was formerly called rect.

+

Both rects are represented with +{x1: number, y1: number, x2: number, y2: number, width: number, height: number} objects.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onAnnotationMenuPress = {({annotationMenu, annotations}) => {
+    console.log('Annotation menu item', annotationMenu, 'has been pressed');
+    annotations.forEach(annotation => {
+      console.log('The id of selected annotation is', annotation.id);
+      console.log('The page number of selected annotation is', annotation.pageNumber);
+      console.log('The type of selected annotation is', annotation.type);
+      console.log('The screenRect of selected annotation is', annotation.screenRect);
+      console.log('The pageRect of selected annotation is', annotation.pageRect);
+    });
+  }}
+/>
+ + + +
+ +
+

Annotations


+ + + +
+

onAnnotationsSelected

+ + +
+
+ + +
+

This function is called when an annotation(s) is selected.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 606 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotations + + +Array<object> + + + + +

array of annotation data in the format +{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}, +representing the selected annotations.

+

type is one of the Config.Tools constants.

+

screenRect was formerly called rect.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onAnnotationsSelected = {({annotations}) => {
+    annotations.forEach(annotation => {
+      console.log('The id of selected annotation is', annotation.id);
+      console.log('It is in page', annotation.pageNumber);
+      console.log('Its type is', annotation.type);
+    });
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onAnnotationChanged

+ + +
+
+ + +
+

This function is called if a change has been made to an annotation(s) +in the current document.

+

Note: When an annotation is flattened, it also gets deleted, so both +onAnnotationChanged and +onAnnotationFlattened are called.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 638 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
action + + +string + + + + +

the action that occurred (add, delete, modify)

annotations + + +Array<object> + + + + +

array of annotation data in the format +{id: string, pageNumber: number, type: string}, +representing the annotations that have been changed.

+

type is one of the Config.Tools constants

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onAnnotationChanged = {({action, annotations}) => {
+    console.log('Annotation edit action is', action);
+    annotations.forEach(annotation => {
+      console.log('The id of changed annotation is', annotation.id);
+      console.log('It is in page', annotation.pageNumber);
+      console.log('Its type is', annotation.type);
+    });
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onFormFieldValueChanged

+ + +
+
+ + +
+

This function is called if a change has been made to form field values.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 660 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fields + + +Array<object> + + + + +

array of field data in the format +{fieldName: string, fieldType: string, fieldValue: any}, +representing the fields that have been changed

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onFormFieldValueChanged = {({fields}) => {
+    fields.forEach(field => {
+      console.log('The name of the changed field is', field.fieldName);
+      console.log('The type of the changed field is', field.fieldType);
+      console.log('The value of the changed field is', field.fieldValue);
+    });
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onAnnotationFlattened

+ + +
+
+ + +
+

This function is called if an annotation(s) has been flattened in the +current document.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 687 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
annotations + + +Array<object> + + + + +

array of annotation data in the format +{id: string, pageNumber: number, type: string}, +representing the annotations that have been changed.

+

type is one of the Config.Tools constants

+

id returned via the event listener can be null.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onAnnotationFlattened={({annotations}) => {
+          annotations.forEach(annotation => {
+            console.log('The id of changed annotation is', annotation.id);
+            console.log('It is in page', annotation.pageNumber);
+            console.log('Its type is', annotation.type);
+          });
+        }}
+/>
+ + + +
+ +
+

Bookmark


+ + + +
+

onBookmarkChanged

+ + +
+
+ + +
+

This function is called if a change has been made to user bookmarks.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1196 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bookmarkJson + + +string + + + + +

the list of current bookmarks in JSON format

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onBookmarkChanged = {({bookmarkJson}) => {
+    console.log('Bookmarks have been changed. Current bookmark collection is', bookmarkJson);
+  }}
+/>
+ + + +
+ +
+

Custom Behavior


+ + + +
+

onBehaviorActivated

+ + +
+
+ + +
+

This function is called if the activated behavior is passed in to +overrideBehavior

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 485 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
action + + +Config.Actions + + + + +

the action which has been activated.

data + + +object + + + + +

A JSON object that varies depending on the action.

+

If action is Config.Actions.linkPress, data type is {url: string}.

+

If action is Config.Actions.stickyNoteShowPopUp, data type is +{id: string, pageNumber: number, type: string, screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}, pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}

+

type is one of the Config.Tools constants,

+

screenRect was formerly called rect.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onBehaviorActivated = {({action, data}) => {
+    console.log('Activated action is', action);
+    if (action === Config.Actions.linkPress) {
+      console.log('The external link pressed is', data.url);
+    } else if (action === Config.Actions.stickyNoteShowPopUp) {
+      console.log('Sticky note has been activated, but it would not show a pop up window.');
+    }
+  }}
+/>
+ + + +
+ +
+

Import/Export Annotations


+ + + +
+

onExportAnnotationCommand

+ + +
+
+ + +
+

This function is called if a change has been made to annotations in the current document. +Unlike onAnnotationChanged, this function has +an XFDF command string as its parameter. If you are modifying or deleting multiple annotations, +then on Android the function is only called once, and on iOS it is called for each annotation.

+

Known Issues

+

On iOS, there is currently a bug that prevents the last XFDF from being retrieved when +modifying annotations while collaboration mode is enabled.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 935 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
action + + +string + + + + +

the action that occurred (add, delete, modify)

xfdfCommand + + +string + + + + +

an xfdf string containing info about the edit

annotations + + +array + + + + +

an array of annotation data. +When collaboration is enabled data comes in the format {id: string}, otherwise the format is +{id: string, pageNumber: number, type: string}. +In both cases, the data represents the annotations that have been changed.

+

type is one of the Config.Tools constants.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onExportAnnotationCommand = {({action, xfdfCommand, annotations}) => {
+    console.log('Annotation edit action is', action);
+    console.log('The exported xfdfCommand is', xfdfCommand);
+    annotations.forEach((annotation) => {
+      console.log('Annotation id is', annotation.id);
+    if (!this.state.collabEnabled) {
+        console.log('Annotation pageNumber is', annotation.pageNumber);
+        console.log('Annotation type is', annotation.type);
+      }
+    });
+    }}
+    collabEnabled={this.state.collabEnabled}
+    currentUser={'Pdftron'}
+/>
+ + + +
+ +
+

Layout


+ + + +
+

onLayoutChanged

+ + +
+
+ + +
+

This function is called when the layout of the viewer has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 756 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onLayoutChanged = {() => {
+    console.log('Layout has been updated.');
+  }}
+/>
+ + + +
+ +
+

Long Press Menu


+ + + +
+

onLongPressMenuPress

+ + +
+
+ + +
+

This function is called if the pressed long press menu item is passed in to +overrideLongPressMenuBehavior.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 347 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
longPressMenu + + +Config.LongPressMenu + + + + +

the menu item that has been pressed.

longPressText + + +string + + + + +

the selected text if pressed on text, empty otherwise

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onLongPressMenuPress = {({longPressMenu, longPressText}) => {
+    console.log('Long press menu item', longPressMenu, 'has been pressed');
+    if (longPressText !== '') {
+      console.log('The selected text is', longPressText);
+    }
+  }}
+/>
+ + + +
+ +
+

Multi-tab


+ + + +
+

onTabChanged

+ + +
+
+ + +
+

The function is activated when a tab is changed.

+

This API is meant for tab-specific changes. +If you would like to know when the document finishes loading instead, see +the onDocumentLoaded event.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1748 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
currentTab + + +string + + + + +

The file path of current tab's document

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  multiTabEnabled={true}
+  onTabChanged={({currentTab}) => {
+    console.log("The current tab is ", currentTab);
+  }}
+/>
+ + + +
+ +
+

Open a Document


+ + + +
+

onDocumentLoaded

+ + +
+
+ + +
+

This function is called when the document finishes loading.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 175 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameType
path + + +string + + + + +
+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onDocumentLoaded = {(path) => {
+    console.log('The document has finished loading:', path);
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onDocumentError

+ + +
+
+ + +
+

This function is called when document opening encounters an error.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 191 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameType
error + + +string + + + + +
+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onDocumentError = {(error) => {
+    console.log('Error occured during document opening:', error);
+  }}
+/>
+ + + +
+ +
+

Page


+ + + +
+

onPageChanged

+ + +
+
+ + +
+

This function is called when the page number has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 208 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
previousPageNumber + + +int + + + + +

the previous page number

pageNumber + + +int + + + + +

the current page number

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onPageChanged = {({previousPageNumber, pageNumber}) => {
+    console.log('Page number changes from', previousPageNumber, 'to', pageNumber);
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onPageMoved

+ + +
+
+ + +
+

This function is called when a page has been moved in the document.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1727 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
previousPageNumber + + +int + + + + +

the previous page number

pageNumber + + +int + + + + +

the current page number

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onPageMoved = {({previousPageNumber, pageNumber}) => {
+    console.log('Page moved from', previousPageNumber, 'to', pageNumber);
+  }}
+/>
+ + + +
+ +
+

Scroll


+ + + +
+

onScrollChanged

+ + +
+
+ + +
+

This function is called when the scroll position has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 226 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
horizontal + + +number + + + + +

the horizontal position of the scroll

vertical + + +number + + + + +

the vertical position of the scroll

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onScrollChanged = {({horizontal, vertical}) => {
+    console.log('Current scroll position is', horizontal,
+     'horizontally, and', vertical, 'vertically.');
+  }}
+/>
+ + + +
+ +
+

Text Selection


+ + + +
+

onTextSearchStart

+ + +
+
+ + +
+

This function is called immediately before a text search begins, +either through user actions, or function calls such as findText.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1268 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onTextSearchStart = {() => {
+    console.log('Text search has started');
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onTextSearchResult

+ + +
+
+ + +
+

This function is called after a text search is finished or canceled.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1306 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
found + + +boolean + + + + +

whether a result is found. +If false, it could be caused by not finding a matching result in the document, +invalid text input, or action cancellation +(user actions or cancelFindText)

textSelection + + +object + + + + +

the text selection, in the format +{html: string, unicode: string, pageNumber: number, quads: [[{x: number, y: number}, {x: number, y: number}, {x: number, y: number}, {x: number, y: number}], ...]}. If no such selection could be found, this would be null

+

Quads indicate the quad boundary boxes for the selection, +which could have a size larger than 1 if selection spans across different lines. +Each quad have 4 points with x, y coordinates specified in number, representing a boundary box. +The 4 points are in counter-clockwise order, though the first point is not guaranteed to be on +lower-left relatively to the box.

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onTextSearchResult = {({found, textSelection}) => {
+    if (found) {
+      console.log('Found selection on page', textSelection.pageNumber);
+      for (let i = 0; i < textSelection.quads.length; i ++) {
+        const quad = textSelection.quads[i];
+        console.log('selection boundary quad', i);
+        for (const quadPoint of quad) {
+          console.log('A quad point has coordinates', quadPoint.x, quadPoint.y);
+        }
+      }
+    }
+  }}
+/>
+ + + +
+ +
+

UI Customization


+ + + +
+

onLeadingNavButtonPressed

+ + +
+
+ + +
+

This function is called when the leading navigation button is pressed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 159 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onLeadingNavButtonPressed = {() => {
+      console.log('The leading nav has been pressed');
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onToolChanged

+ + +
+
+ + +
+

This function is called when the current tool changes to a new tool

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1228 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
previousTool + + +Config.Tools +| + +string + + + + +

the previous tool +(one of the Config.Tools constants or "unknown tool"), +representing the tool before change

tool + + +Config.Tools +| + +string + + + + +

the current tool (one of the Config.Tools constants +or "unknown tool"), representing the current tool

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onToolChanged = {({previousTool, tool}) => {
+    console.log('Tool has been changed from', previousTool, 'to', tool);
+  }}
+/>
+ + + +
+ +
+

Undo/Redo


+ + + +
+

onUndoRedoStateChanged

+ + +
+
+ + +
+

This function is called when the state of the current document's +undo/redo stack has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 1482 +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onUndoRedoStateChanged = {() => {
+    console.log("Undo/redo stack state changed");
+  }}
+/>
+ + + +
+ +
+

Zoom


+ + + +
+

onZoomChanged

+ + +
+
+ + +
+

This function is called when the zoom scale has been changed.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 242 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
zoom + + +double + + + + +

the current zoom ratio of the document

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onZoomChanged = {(zoom) => {
+    console.log('Current zoom ratio is', zoom);
+  }}
+/>
+ + + +
+ + + +
+ + +
+

onZoomFinished

+ + +
+
+ + +
+

This function is called when a zooming has been finished. +For example, if zoom via gesture, this is called on gesture release.

+
+ + + + + + +
+ Type: + +function + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Optional. +
+ + + + + +
+ Source: + DocumentView.js + + line 259 +
+ + + + + + + + + + + + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
zoom + + +double + + + + +

the current zoom ratio of the document

+ + + + + + + + + + + + + + + + +
Example
+ +
<DocumentView
+  onZoomFinished = {(zoom) => {
+    console.log('Current zoom ratio is', zoom);
+  }}
+/>
+ + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/glyphicons-halflings-regular.eot b/docs/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 000000000..b93a4953f Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.eot differ diff --git a/docs/fonts/glyphicons-halflings-regular.svg b/docs/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 000000000..94fb5490a --- /dev/null +++ b/docs/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/glyphicons-halflings-regular.ttf b/docs/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 000000000..1413fc609 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.ttf differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff b/docs/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 000000000..9e612858f Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.woff differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff2 b/docs/fonts/glyphicons-halflings-regular.woff2 new file mode 100644 index 000000000..64539b54c Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.woff2 differ diff --git a/docs/img/glyphicons-halflings-white.png b/docs/img/glyphicons-halflings-white.png new file mode 100644 index 000000000..3bf6484a2 Binary files /dev/null and b/docs/img/glyphicons-halflings-white.png differ diff --git a/docs/img/glyphicons-halflings.png b/docs/img/glyphicons-halflings.png new file mode 100644 index 000000000..a99699932 Binary files /dev/null and b/docs/img/glyphicons-halflings.png differ diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 000000000..eeec30455 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,264 @@ + + + + + + + PDFTron React Native Index + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+

PDFTron React Native API

+

PDFTron's React Native PDF Library allows applications to use JavaScript to build cross-platform mobile apps.

+

The application UI is rendered using native views to provide users the fluid look and feel of traditional native applications.

+

TypeScript

+

Starting with version 3.0.0, PDFTron React Native provides support for TypeScript!

+

For TypeScript users, type information is automatically provided while coding. Exact type aliases and constants used in our custom typings can also be found in our TypeScript source files.

+

The typings used in these API docs will be described using normal JavaScript types.

+

Frequently used

+
    +
  • Config - Defines configuration constants for the viewer.
  • +
  • DocumentView - An all-in-one React component for displaying and editing documents of different types.
  • +
  • RNPdftron - Contains static methods for global library initialization, configuration, and utility methods.
  • +
+

Links

+

For instantiation, information, and source code, see our GitHub.

+

For guides and support, visit us at the PDFTron website.

+
+ + + + + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/index.ts.html b/docs/index.ts.html new file mode 100644 index 000000000..55a9d197e --- /dev/null +++ b/docs/index.ts.html @@ -0,0 +1,377 @@ + + + + + + + PDFTron React Native Source: index.ts + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: index.ts

+ +
+
+
import { NativeModules } from 'react-native';
+import { PDFViewCtrl } from './src/PDFViewCtrl/PDFViewCtrl';
+import { DocumentView } from './src/DocumentView/DocumentView';
+import { Config } from './src/Config/Config';
+import * as AnnotOptions from './src/AnnotOptions/AnnotOptions';
+
+/**
+ * @typedef RNPdftron
+ * @hidesource
+ * @desc RNPdftron contains static methods for global library initialization, configuration, and 
+ * utility methods.
+ */
+interface RNPdftron 
+{
+  /**
+   * @method
+   * @desc Initializes PDFTron SDK with your PDFTron commercial license key. 
+   * You can run PDFTron in demo mode by passing an empty string.
+   * @param {string} licenseKey your PDFTron license key
+   * @example RNPdftron.initialize('your_license_key');
+   */
+  initialize(licenseKey: string) : void;
+  
+  /**
+   * @method
+   * @desc Enables JavaScript engine for PDFTron SDK, by default it is enabled.
+   * @param {boolean} enabled whether to enable or disable JavaScript engine
+   * @example RNPdftron.enableJavaScript(true);
+   */
+  enableJavaScript(enabled: boolean) : void;
+
+  /**
+   * @method
+   * @desc Gets the current PDFNet version.
+   * @returns {Promise<string>} version - current PDFNet version
+   * @example
+   * RNPdftron.getVersion().then((version) => {
+   *   console.log("Current PDFNet version:", version);
+   * });
+   */
+  getVersion() : Promise<string>;
+
+  /**
+   * @method
+   * @desc Gets the version of current platform (Android/iOS).
+   * @returns {Promise<string>} platformVersion - current platform version (Android/iOS)
+   * @example
+   * RNPdftron.getPlatformVersion().then((platformVersion) => {
+   *   console.log("App currently running on:", platformVersion);
+   * });
+   */
+  getPlatformVersion() : Promise<string>;
+
+  /**
+   * @method
+   * @desc Gets the font list available on the OS (Android only).
+   * This is typically useful when you are mostly working with non-ascii characters in the viewer.
+   * @returns {Promise<string>} fontList - the font list available on Android
+   * @example
+   * RNPdftron.getSystemFontList().then((fontList) => {
+   *   console.log("OS font list:", fontList);
+   * });
+   */
+  getSystemFontList() : Promise<string>;
+
+  /**
+   * @method
+   * @desc Clear the information and bitmap cache for rubber stamps (Android only).
+   * This is typically useful when the content of rubber stamps has been changed in the viewer.
+   * @example
+   * RNPdftron.clearRubberStampCache().then(() => {
+   *   console.log("Rubber stamp cache cleared");
+   * });
+   */
+  clearRubberStampCache() : Promise<void>;
+
+  /**
+   * @method
+   * @desc Encrypts (password-protect) a document (must be a PDF). 
+   * 
+   * **Note**: This function does not lock the document, 
+   * it cannot be used while the document is opened in the viewer.
+   * @param {string} filePath the local file path to the file
+   * @param {string} password the password you would like to set
+   * @param {string} currentPassword the current password, use empty string if no password
+   * @example
+   * RNPdftron.encryptDocument("/sdcard/Download/new.pdf", "1111", "").then(() => {
+   *   console.log("done password");
+   * });
+   */
+  encryptDocument(filePath: string, password: string, currentPassword: string) : Promise<void>;
+
+  /**
+   * @method
+   * @desc Generates a PDF using a template in the form of an Office document 
+   * and replacement data in the form of a JSON object.
+   * For more information please see our 
+   * [template guide](https://www.pdftron.com/documentation/core/guides/generate-via-template/).
+   * 
+   * The user is responsible for cleaning up the temporary file that is generated.
+   * @param {string} docxPath the local file path to the template file
+   * @param {object} json the replacement data in the form of a JSON object
+   * @returns {Promise<string>} resultPdfPath - the local file path to the generated PDF 
+   * @example
+   * RNPdftron.pdfFromOfficeTemplate("/sdcard/Download/red.docx", json).then((resultPdfPath) => {
+   *   console.log(resultPdfPath);
+   * });
+   */
+  pdfFromOfficeTemplate(docxPath: string, json: object) : Promise<string>;
+
+  /**
+   * @method
+   * @desc Export a PDF page to an image format defined in {@link Config.ExportFormat}. 
+   * 
+   * Unlike {@link DocumentView#exportAsImage DocumentView.exportAsImage}, 
+   * this method is static and should only be called *before* a `DocumentView` 
+   * instance has been created or else unexpected behaviour can occur. 
+   * This method also takes a local file path to the desired PDF.
+   * @param {int} pageNumber the page to be converted; 
+   * if the value does not refer to a valid page number, the file path will be undefined
+   * @param {double} dpi the output image resolution
+   * @param {Config.ExportFormat} exportFormat image format to be exported to
+   * @param {string} filePath local file path to pdf
+   * @returns {Promise<string>} resultImagePath - the temp path of the created image, 
+   * user is responsible for clean up the cache
+   * @example
+   * RNPdftron.exportAsImage(1, 92, Config.ExportFormat.BMP, "/sdcard/Download/red.pdf").then(
+   *  (resultImagePath) => {
+   *   console.log('export', resultImagePath);
+   * });
+   */
+  exportAsImage(pageNumber: number, dpi: number, 
+    exportFormat: Config.ExportFormat, filePath: string) : Promise<string>;
+}
+
+/**
+ * @class
+ * @hideconstructor
+ */
+// eslint-disable-next-line no-redeclare
+const RNPdftron : RNPdftron = NativeModules.RNPdftron;
+
+export {
+  RNPdftron,
+  PDFViewCtrl,
+  DocumentView,
+  Config,
+  AnnotOptions
+};
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/lib_src_Config_Config.js.html b/docs/lib_src_Config_Config.js.html new file mode 100644 index 000000000..fd9428139 --- /dev/null +++ b/docs/lib_src_Config_Config.js.html @@ -0,0 +1,571 @@ + + + + + + + PDFTron React Native Source: lib/src/Config/Config.js + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: lib/src/Config/Config.js

+ +
+
+
/**
+ * @constant
+ * @class (Assigned to class for documentation purposes.)
+ * @hideconstructor
+ * @name Config
+ * @classdesc Defines configuration constants for the viewer.
+ * See [`Config.ts`](https://github.com/PDFTron/pdftron-react-native/blob/master/src/Config/Config.ts)
+ * for the full list of constants.
+ *
+ * Due to the length of the source file, we have included links to the exact lines
+ * of the source code where these APIs have been implemented.
+ */
+export const Config = {
+    /**
+     * @member
+     * @desc Buttons define the various kinds of buttons for the viewer
+     */
+    Buttons: {
+        editToolButton: 'editToolButton',
+        viewControlsButton: 'viewControlsButton',
+        freeHandToolButton: 'freeHandToolButton',
+        highlightToolButton: 'highlightToolButton',
+        underlineToolButton: 'underlineToolButton',
+        squigglyToolButton: 'squigglyToolButton',
+        strikeoutToolButton: 'strikeoutToolButton',
+        rectangleToolButton: 'rectangleToolButton',
+        ellipseToolButton: 'ellipseToolButton',
+        lineToolButton: 'lineToolButton',
+        arrowToolButton: 'arrowToolButton',
+        polylineToolButton: 'polylineToolButton',
+        polygonToolButton: 'polygonToolButton',
+        cloudToolButton: 'cloudToolButton',
+        signatureToolButton: 'signatureToolButton',
+        freeTextToolButton: 'freeTextToolButton',
+        stickyToolButton: 'stickyToolButton',
+        calloutToolButton: 'calloutToolButton',
+        stampToolButton: 'stampToolButton',
+        toolsButton: 'toolsButton',
+        searchButton: 'searchButton',
+        shareButton: 'shareButton',
+        editPagesButton: 'editPagesButton',
+        viewLayersButton: 'viewLayersButton',
+        printButton: 'printButton',
+        closeButton: 'closeButton',
+        saveCopyButton: 'saveCopyButton',
+        saveIdenticalCopyButton: 'saveIdenticalCopyButton',
+        saveFlattenedCopyButton: 'saveFlattenedCopyButton',
+        formToolsButton: 'formToolsButton',
+        fillSignToolsButton: 'fillSignToolsButton',
+        moreItemsButton: 'moreItemsButton',
+        digitalSignatureButton: 'digitalSignatureButton',
+        thumbnailsButton: 'thumbnailsButton',
+        listsButton: 'listsButton',
+        thumbnailSlider: 'thumbnailSlider',
+        outlineListButton: 'outlineListButton',
+        annotationListButton: 'annotationListButton',
+        userBookmarkListButton: 'userBookmarkListButton',
+        reflowButton: 'reflowButton',
+        editMenuButton: 'editMenuButton',
+        cropPageButton: 'cropPageButton',
+        undo: 'undo',
+        redo: 'redo',
+        addPageButton: 'addPageButton',
+        // Android only
+        saveReducedCopyButton: 'saveReducedCopyButton',
+        saveCroppedCopyButton: 'saveCroppedCopyButton',
+        savePasswordCopyButton: 'savePasswordCopyButton'
+    },
+    /**
+     * @member
+     * @desc Tools define the various kinds of tools for the viewer
+     */
+    Tools: {
+        annotationEdit: 'AnnotationEdit',
+        textSelect: 'TextSelect',
+        multiSelect: 'MultiSelect',
+        pan: 'Pan',
+        annotationEraserTool: 'AnnotationEraserTool',
+        annotationCreateSticky: 'AnnotationCreateSticky',
+        annotationCreateFreeHand: 'AnnotationCreateFreeHand',
+        annotationCreateTextHighlight: 'AnnotationCreateTextHighlight',
+        annotationCreateTextUnderline: 'AnnotationCreateTextUnderline',
+        annotationCreateTextSquiggly: 'AnnotationCreateTextSquiggly',
+        annotationCreateTextStrikeout: 'AnnotationCreateTextStrikeout',
+        annotationCreateFreeText: 'AnnotationCreateFreeText',
+        annotationCreateCallout: 'AnnotationCreateCallout',
+        annotationCreateSignature: 'AnnotationCreateSignature',
+        annotationCreateLine: 'AnnotationCreateLine',
+        annotationCreateArrow: 'AnnotationCreateArrow',
+        annotationCreatePolyline: 'AnnotationCreatePolyline',
+        annotationCreateStamp: 'AnnotationCreateStamp',
+        annotationCreateRubberStamp: 'AnnotationCreateRubberStamp',
+        annotationCreateRectangle: 'AnnotationCreateRectangle',
+        annotationCreateEllipse: 'AnnotationCreateEllipse',
+        annotationCreatePolygon: 'AnnotationCreatePolygon',
+        annotationCreatePolygonCloud: 'AnnotationCreatePolygonCloud',
+        annotationCreateDistanceMeasurement: 'AnnotationCreateDistanceMeasurement',
+        annotationCreatePerimeterMeasurement: 'AnnotationCreatePerimeterMeasurement',
+        annotationCreateAreaMeasurement: 'AnnotationCreateAreaMeasurement',
+        annotationCreateFileAttachment: 'AnnotationCreateFileAttachment',
+        annotationCreateSound: 'AnnotationCreateSound',
+        annotationCreateRedaction: 'AnnotationCreateRedaction',
+        annotationCreateLink: 'AnnotationCreateLink',
+        annotationCreateRedactionText: 'AnnotationCreateRedactionText',
+        annotationCreateLinkText: 'AnnotationCreateLinkText',
+        annotationCreateFreeHighlighter: 'AnnotationCreateFreeHighlighter',
+        annotationCreateSmartPen: 'AnnotationCreateSmartPen',
+        formCreateTextField: 'FormCreateTextField',
+        formCreateCheckboxField: 'FormCreateCheckboxField',
+        formCreateSignatureField: 'FormCreateSignatureField',
+        formCreateRadioField: 'FormCreateRadioField',
+        formCreateComboBoxField: 'FormCreateComboBoxField',
+        formCreateListBoxField: 'FormCreateListBoxField',
+        // iOS only.
+        pencilKitDrawing: 'PencilKitDrawing'
+    },
+    /**
+     * @member
+     * @desc FitMode define how a page should fit relative to the viewer,
+     * alternatively, the default zoom level
+     */
+    FitMode: {
+        FitPage: 'FitPage',
+        FitWidth: 'FitWidth',
+        FitHeight: 'FitHeight',
+        Zoom: 'Zoom'
+    },
+    /**
+     * @member
+     * @desc LayoutMode defines the layout mode of the viewer
+     */
+    LayoutMode: {
+        Single: 'Single',
+        Continuous: 'Continuous',
+        Facing: 'Facing',
+        FacingContinuous: 'FacingContinuous',
+        FacingCover: 'FacingCover',
+        FacingCoverContinuous: 'FacingCoverContinuous'
+    },
+    /**
+     * @member
+     * @desc FieldFlags define the property flags for a form field
+     */
+    FieldFlags: {
+        ReadOnly: 0,
+        Required: 1
+    },
+    /**
+     * @member
+     * @desc AnnotationMenu defines the menu items when an annotation is selected
+     */
+    AnnotationMenu: {
+        style: 'style',
+        note: 'note',
+        copy: 'copy',
+        duplicate: 'duplicate',
+        delete: 'delete',
+        flatten: 'flatten',
+        editText: 'editText',
+        editInk: 'editInk',
+        search: 'search',
+        share: 'share',
+        markupType: 'markupType',
+        read: 'read',
+        screenCapture: 'screenCapture',
+        playSound: 'playSound',
+        openAttachment: 'openAttachment',
+        calibrate: 'calibrate'
+    },
+    /**
+     * @member
+     * @desc EraserType defines the type of eraser that will be used when eraser is selected
+     */
+    EraserType: {
+        annotationEraser: 'annotationEraser',
+        hybrideEraser: 'hybrideEraser',
+        inkEraser: 'inkEraser'
+    },
+    /**
+     * @member
+     * @desc LongPressMenu defines the menu items when a long press on empty space or text occurs
+     */
+    LongPressMenu: {
+        copy: 'copy',
+        paste: 'paste',
+        search: 'search',
+        share: 'share',
+        read: 'read'
+    },
+    /**
+     * @member
+     * @desc Actions define potentially overridable action to the viewer
+     */
+    Actions: {
+        linkPress: 'linkPress',
+        stickyNoteShowPopUp: 'stickyNoteShowPopUp'
+    },
+    /**
+     * @member
+     * @desc AnnotationFlags define the flags for any annotation in the document
+     */
+    AnnotationFlags: {
+        hidden: "hidden",
+        invisible: "invisible",
+        locked: "locked",
+        lockedContents: "lockedContents",
+        noRotate: "noRotate",
+        noView: "noView",
+        noZoom: "noZoom",
+        print: "print",
+        readOnly: "readOnly",
+        toggleNoView: "toggleNoView"
+    },
+    /**
+     * @member
+     * @desc DefaultToolbars define a set of pre-designed toolbars for easier customization
+     */
+    DefaultToolbars: {
+        View: "PDFTron_View",
+        Annotate: "PDFTron_Annotate",
+        Draw: "PDFTron_Draw",
+        Insert: "PDFTron_Insert",
+        FillAndSign: "PDFTron_Fill_and_Sign",
+        PrepareForm: "PDFTron_Prepare_Form",
+        Measure: "PDFTron_Measure",
+        Pens: "PDFTron_Pens",
+        Redaction: "PDFTron_Redact",
+        Favorite: "PDFTron_Favorite"
+    },
+    /**
+     * @member
+     * @desc ToolbarIcons define default toolbar icons for use for potential custom toolbars
+     */
+    ToolbarIcons: {
+        View: "PDFTron_View",
+        Annotate: "PDFTron_Annotate",
+        Draw: "PDFTron_Draw",
+        Insert: "PDFTron_Insert",
+        FillAndSign: "PDFTron_Fill_and_Sign",
+        PrepareForm: "PDFTron_Prepare_Form",
+        Measure: "PDFTron_Measure",
+        Pens: "PDFTron_Pens",
+        Redaction: "PDFTron_Redact",
+        Favorite: "PDFTron_Favorite"
+    },
+    /**
+     * @member
+     * @desc CustomToolbarKey defines the necessary keys for a custom toolbar
+     */
+    CustomToolbarKey: {
+        Id: "id",
+        Name: "name",
+        Icon: "icon",
+        Items: "items"
+    },
+    /**
+     * @member
+     * @desc ThumbnailFilterMode defines filter modes in the thumbnails browser
+     */
+    ThumbnailFilterMode: {
+        Annotated: "annotated",
+        Bookmarked: "bookmarked"
+    },
+    /**
+     * @member
+     * @desc Conversion defines conversion sources and destinations
+     */
+    Conversion: {
+        Screen: "screen",
+        Canvas: "canvas",
+        Page: "page"
+    },
+    /**
+     * @member
+     * @desc ViewModePickerItem defines view mode items in the view mode dialog
+     */
+    ViewModePickerItem: {
+        Crop: "viewModeCrop",
+        Rotation: "viewModeRotation",
+        ColorMode: "viewModeColorMode"
+    },
+    /**
+     * @member
+     * @desc ZoomLimitMode defines the limit mode for zoom in the current document viewer
+     */
+    ZoomLimitMode: {
+        None: "none",
+        Absolute: "absolute",
+        Relative: "relative"
+    },
+    /**
+     * @member
+     * @desc OverprintMode defines when overprint would be applied in the viewer
+     */
+    OverprintMode: {
+        On: "on",
+        Off: "off",
+        OnlyPDFX: "pdfx" // only apply to PDF/X files
+    },
+    /**
+     * @member
+     * @desc ColorPostProcessMode defines color modifications after rendering in the viewer
+     */
+    ColorPostProcessMode: {
+        None: "none",
+        Invert: "invert",
+        GradientMap: "gradientMap",
+        NightMode: "nightMode"
+    },
+    /**
+     * @member
+     * @desc ReflowOrientation defines the scrolling direction when in reflow viewing mode
+     */
+    ReflowOrientation: {
+        Horizontal: 'horizontal',
+        Vertical: 'vertical'
+    },
+    /**
+     * @member
+     * @desc Export to format
+     */
+    ExportFormat: {
+        BMP: "BMP",
+        JPEG: "JPEG",
+        PNG: "PNG"
+    },
+    /**
+     * @member
+     * @desc AnnotationManagerEditMode determines whose changes can be edited.
+     */
+    AnnotationManagerEditMode: {
+        Own: "own",
+        All: "all"
+    },
+    /**
+     * @member
+     * @desc AnnotationManagerUndoMode determines whose changes can be undone.
+     */
+    AnnotationManagerUndoMode: {
+        Own: "own",
+        All: "all"
+    }
+};
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/lib_src_DocumentView_DocumentView.js.html b/docs/lib_src_DocumentView_DocumentView.js.html new file mode 100644 index 000000000..10a9e270f --- /dev/null +++ b/docs/lib_src_DocumentView_DocumentView.js.html @@ -0,0 +1,4192 @@ + + + + + + + PDFTron React Native Source: lib/src/DocumentView/DocumentView.js + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: lib/src/DocumentView/DocumentView.js

+ +
+
+
import React, { PureComponent } from 'react';
+import PropTypes from 'prop-types';
+import { requireNativeComponent, ViewPropTypes, Platform, Alert, NativeModules, findNodeHandle } from 'react-native';
+import { Config } from "../Config/Config";
+const { DocumentViewManager } = NativeModules;
+/**
+ * @desc This object outlines valid {@link DocumentView} class props.
+ * These can be passed into {@link DocumentView} to customize the viewer.
+ *
+ * For Contributors: The propTypes interface below contains PropTypes types for
+ * the {@link DocumentView} class.
+ * It is also used to generate custom types for TS users.
+ *
+ * Add comment to trigger update JS files.
+ *
+ * To represent functions, please use {@link func}.
+ * To represent "one of Config.Buttons values" or "an array of
+ * Config.Buttons values", please use {@link oneOf} or {@link arrayOf}.
+ *
+ * @ignore
+ */
+export const DocumentViewPropTypes = {
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {string}
+     * @desc The path or url to the document. Required.
+     * @example
+     * <DocumentView
+     *   document={'https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_about.pdf'}
+     * />
+     */
+    document: PropTypes.string.isRequired,
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {string}
+     * @optional
+     * @desc The password of the document, if any.
+     * @example
+     * <DocumentView
+     *   password={'password'}
+     * />
+     */
+    password: PropTypes.string,
+    /**
+     * @memberof DocumentView
+     * @category Page
+     * @type {number}
+     * @optional
+     * @desc Defines the initial page number that viewer displays when the document is opened.
+     * Note that page numbers are 1-indexed.
+     * @example
+     * <DocumentView
+     *   initialPageNumber={5}
+     * />
+     */
+    initialPageNumber: PropTypes.number,
+    /**
+     * @memberof DocumentView
+     * @category Page
+     * @type {number}
+     * @optional
+     * @desc Defines the currently displayed page number.
+     * Different from {@link DocumentView.initialPageNumber initialPageNumber},
+     * changing this prop value at runtime will change the page accordingly.
+     * @example
+     * <DocumentView
+     *   pageNumber={5}
+     * />
+     */
+    pageNumber: PropTypes.number,
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {object}
+     * @optional
+     * @desc Defines custom headers to use with HTTP/HTTPS requests.
+     * @example
+     * <DocumentView
+     *   customHeaders={{headerKey: 'headerValue'}}
+     * />
+     */
+    customHeaders: PropTypes.object,
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {string}
+     * @optional
+     * @desc The file name of the icon to be used for the leading navigation button.
+     * The button will use the specified icon if it is valid, and the default icon otherwise.
+     *
+     * **Note**: to add the image file to your application, please follow the steps below:
+     *
+     * ##### Android
+     * 1. Add the image resource to the drawable directory in
+     * [`example/android/app/src/main/res`](https://github.com/PDFTron/pdftron-react-native/blob/master/example/android/app/src/main/res).
+     * For details about supported file types and potential compression, check out
+     * [here](https://developer.android.com/guide/topics/graphics/drawables#drawables-from-images).
+     *
+     * <img alt='demo-android' src='https://pdftron.s3.amazonaws.com/custom/websitefiles/react-native/android_add_resources.png'/>
+     * <br/><br/>
+     * 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 [`example.xcworkspace`](https://github.com/PDFTron/pdftron-react-native/tree/master/example/ios/example.xcworkspace)),
+     * and navigate through the list below.
+     * This would allow you to add resources, in this case, an image, to your project.
+     * - "Project navigator"
+     * - "example" (or the app name)
+     * - "Build Phases"
+     * - "Copy Bundle Resources"
+     * - "+".
+     *
+     * <img alt='demo-ios' src='https://pdftron.s3.amazonaws.com/custom/websitefiles/react-native/ios_add_resources.png'/>
+     * <br/><br/>
+     * 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.
+     *
+     * @example
+     * let iosNav = 'ic_close_black_24px.png';
+     * let androidNav = 'ic_arrow_back_white_24dp';
+     * <DocumentView
+     *   leadingNavButtonIcon={Platform.OS === 'ios' ? iosNav : androidNav}
+     * />
+     */
+    leadingNavButtonIcon: PropTypes.string,
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether to show the leading navigation button.
+     * @example
+     * <DocumentView
+     *   showLeadingNavButton={true}
+     * />
+     */
+    showLeadingNavButton: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when the leading navigation button is pressed.
+     * @example
+     * <DocumentView
+     *   onLeadingNavButtonPressed = {() => {
+     *       console.log('The leading nav has been pressed');
+     *   }}
+     * />
+     */
+    onLeadingNavButtonPressed: func(),
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when the document finishes loading.
+     * @param {string} path
+     * @example
+     * <DocumentView
+     *   onDocumentLoaded = {(path) => {
+     *     console.log('The document has finished loading:', path);
+     *   }}
+     * />
+     */
+    onDocumentLoaded: func(),
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when document opening encounters an error.
+     * @param {string} error
+     * @example
+     * <DocumentView
+     *   onDocumentError = {(error) => {
+     *     console.log('Error occured during document opening:', error);
+     *   }}
+     * />
+     */
+    onDocumentError: func(),
+    /**
+     * @memberof DocumentView
+     * @category Page
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when the page number has been changed.
+     * @param {int} previousPageNumber the previous page number
+     * @param {int} pageNumber the current page number
+     * @example
+     * <DocumentView
+     *   onPageChanged = {({previousPageNumber, pageNumber}) => {
+     *     console.log('Page number changes from', previousPageNumber, 'to', pageNumber);
+     *   }}
+     * />
+     */
+    onPageChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category Scroll
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when the scroll position has been changed.
+     * @param {number} horizontal the horizontal position of the scroll
+     * @param {number} vertical the vertical position of the scroll
+     * @example
+     * <DocumentView
+     *   onScrollChanged = {({horizontal, vertical}) => {
+     *     console.log('Current scroll position is', horizontal,
+     *      'horizontally, and', vertical, 'vertically.');
+     *   }}
+     * />
+     */
+    onScrollChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category Zoom
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when the zoom scale has been changed.
+     * @param {double} zoom the current zoom ratio of the document
+     * @example
+     * <DocumentView
+     *   onZoomChanged = {(zoom) => {
+     *     console.log('Current zoom ratio is', zoom);
+     *   }}
+     * />
+     */
+    onZoomChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category Zoom
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when a zooming has been finished.
+     * For example, if zoom via gesture, this is called on gesture release.
+     * @param {double} zoom the current zoom ratio of the document
+     * @example
+     * <DocumentView
+     *   onZoomFinished = {(zoom) => {
+     *     console.log('Current zoom ratio is', zoom);
+     *   }}
+     * />
+     */
+    onZoomFinished: func(),
+    /**
+     * @memberof DocumentView
+     * @category Zoom
+     * @type {number}
+     * @optional
+     * @desc Zoom factor used to display the page content.
+     * @example
+     * <DocumentView
+     *   zoom={1}
+     * />
+     */
+    zoom: PropTypes.number,
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {Config.Buttons[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc Defines buttons to be disabled for the viewer.
+     * @example
+     * <DocumentView
+     *   disabledElements={[Config.Buttons.userBookmarkListButton]}
+     * />
+     */
+    disabledElements: arrayOf(Config.Buttons),
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {Config.Tools[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc Defines tools to be disabled for the viewer.
+     * @example
+     * <DocumentView
+     *   disabledTools={[Config.Tools.annotationCreateLine, Config.Tools.annotationCreateRectangle]}
+     * />
+     */
+    disabledTools: arrayOf(Config.Tools),
+    /**
+     * @memberof DocumentView
+     * @category Long Press Menu
+     * @type {Config.LongPressMenu[]}
+     * @optional
+     * @default Contains all the items.
+     * @desc Defines menu items that can show when long press on text or blank space.
+     * @example
+     * <DocumentView
+     *   longPressMenuItems={[Config.LongPressMenu.copy, Config.LongPressMenu.read]}
+     * />
+     */
+    longPressMenuItems: arrayOf(Config.LongPressMenu),
+    /**
+     * @memberof DocumentView
+     * @category Long Press Menu
+     * @type {Config.LongPressMenu[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc 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 function {@link DocumentView.event:onLongPressMenuPress onLongPressMenuPress}
+     * will be called where custom behavior can be implemented.
+     * @example
+     * <DocumentView
+     *   overrideLongPressMenuBehavior={[Config.LongPressMenu.search]}
+     * />
+     */
+    overrideLongPressMenuBehavior: arrayOf(Config.LongPressMenu),
+    /**
+     * @memberof DocumentView
+     * @category Long Press Menu
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called if the pressed long press menu item is passed in to
+     * {@link DocumentView.overrideLongPressMenuBehavior overrideLongPressMenuBehavior}.
+     * @param {Config.LongPressMenu} longPressMenu the menu item that has been pressed.
+     * @param {string} longPressText the selected text if pressed on text, empty otherwise
+     * @example
+     * <DocumentView
+     *   onLongPressMenuPress = {({longPressMenu, longPressText}) => {
+     *     console.log('Long press menu item', longPressMenu, 'has been pressed');
+     *     if (longPressText !== '') {
+     *       console.log('The selected text is', longPressText);
+     *     }
+     *   }}
+     * />
+     */
+    onLongPressMenuPress: func(),
+    /**
+     * @memberof DocumentView
+     * @category Long Press Menu
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether to show the popup menu of options
+     *  when the user long presses on text or blank space on the document.
+     * @example
+     * <DocumentView
+     *   longPressMenuEnabled={true}
+     * />
+     */
+    longPressMenuEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Annotation Menu
+     * @type {Config.AnnotationMenu[]}
+     * @optional
+     * @default Contains all the items.
+     * @desc Defines the menu items that can show when an annotation is selected.
+     * @example
+     * <DocumentView
+     *   annotationMenuItems={[Config.AnnotationMenu.search, Config.AnnotationMenu.share]}
+     * />
+     */
+    annotationMenuItems: arrayOf(Config.AnnotationMenu),
+    /**
+     * @memberof DocumentView
+     * @category Annotation Menu
+     * @type {Config.AnnotationMenu[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc Defines the menu items that will skip default behavior when pressed.
+     * They will still be displayed in the annotation menu,
+     * and the function {@link DocumentView.event:onAnnotationMenuPress onAnnotationMenuPress}
+     * will be called where custom behavior can be implemented.
+     * @example
+     * <DocumentView
+     *   overrideAnnotationMenuBehavior={[Config.AnnotationMenu.copy]}
+     * />
+     */
+    overrideAnnotationMenuBehavior: arrayOf(Config.AnnotationMenu),
+    /**
+     * @memberof DocumentView
+     * @category Annotation Menu
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when an annotation menu item passed in to
+     * {@link DocumentView.overrideAnnotationMenuBehavior overrideAnnotationMenuBehavior} is pressed.
+     * @param {Config.AnnotationMenu} annotationMenu the menu item that has been pressed.
+     * @param {object[]} annotations An array of
+     * `{id: string, pageNumber: number, type: string, screenRect: object, pageRect: object}` objects.
+     *
+     * `id` is the annotation identifier and `type` is one of the {@link Config.Tools} constants.
+     *
+     * `screenRect` was formerly called `rect`.
+     *
+     * Both rects are represented with
+     * `{x1: number, y1: number, x2: number, y2: number, width: number, height: number}` objects.
+     * @example
+     * <DocumentView
+     *   onAnnotationMenuPress = {({annotationMenu, annotations}) => {
+     *     console.log('Annotation menu item', annotationMenu, 'has been pressed');
+     *     annotations.forEach(annotation => {
+     *       console.log('The id of selected annotation is', annotation.id);
+     *       console.log('The page number of selected annotation is', annotation.pageNumber);
+     *       console.log('The type of selected annotation is', annotation.type);
+     *       console.log('The screenRect of selected annotation is', annotation.screenRect);
+     *       console.log('The pageRect of selected annotation is', annotation.pageRect);
+     *     });
+     *   }}
+     * />
+     */
+    onAnnotationMenuPress: func(),
+    /**
+     * @memberof DocumentView
+     * @category Annotation Menu
+     * @type {Config.Tools[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc Defines annotation types that will not show in the annotation (long-press) menu.
+     * @example
+     * <DocumentView
+     *   hideAnnotationMenu={[Config.Tools.annotationCreateArrow, Config.Tools.annotationEraserTool]}
+     * />
+     */
+    hideAnnotationMenu: arrayOf(Config.Tools),
+    /**
+     * @memberof DocumentView
+     * @category Custom Behavior
+     * @type {Config.Actions[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc Defines actions that will skip default behavior, such as external link click.
+     * The function {@link DocumentView.event:onBehaviorActivated onBehaviorActivated} will be
+     * called where custom behavior can be implemented, whenever the defined actions occur.
+     * @example
+     * <DocumentView
+     *   overrideBehavior={[Config.Actions.linkPress]}
+     * />
+     */
+    overrideBehavior: arrayOf(Config.Actions),
+    /**
+     * @memberof DocumentView
+     * @category Custom Behavior
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called if the activated behavior is passed in to
+     * {@link DocumentView.overrideBehavior overrideBehavior}
+     * @param {Config.Actions} action the action which has been activated.
+     * @param {object} data A JSON object that varies depending on the action.
+     *
+     * If action is `Config.Actions.linkPress`, data type is `{url: string}`.
+     *
+     * If action is `Config.Actions.stickyNoteShowPopUp`, data type is
+     * `{id: string, pageNumber: number, type: string,
+     * screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number},
+     * pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`
+     *
+     * `type` is one of the {@link Config.Tools} constants,
+     *
+     * `screenRect` was formerly called `rect`.
+     * @example
+     * <DocumentView
+     *   onBehaviorActivated = {({action, data}) => {
+     *     console.log('Activated action is', action);
+     *     if (action === Config.Actions.linkPress) {
+     *       console.log('The external link pressed is', data.url);
+     *     } else if (action === Config.Actions.stickyNoteShowPopUp) {
+     *       console.log('Sticky note has been activated, but it would not show a pop up window.');
+     *     }
+     *   }}
+     * />
+     */
+    onBehaviorActivated: func(),
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @deprecated Use the {@link DocumentView.hideTopAppNavBar hideTopAppNavBar} prop instead.
+     */
+    topToolbarEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether the bottom toolbar of the viewer is enabled.
+     * @example
+     * <DocumentView
+     *   bottomToolbarEnabled={false}
+     * />
+     */
+    bottomToolbarEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether an unhandled tap in the viewer should toggle the visibility
+     *  of the top and bottom toolbars. When false, the top and bottom toolbar visibility
+     * will not be toggled and the page content will fit between the bars, if any.
+     * @example
+     * <DocumentView
+     *   hideToolbarsOnTap={false}
+     * />
+     */
+    hideToolbarsOnTap: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether the document slider of the viewer is enabled.
+     * @example
+     * <DocumentView
+     *   documentSliderEnabled={false}
+     * />
+     */
+    documentSliderEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Page
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether to show the page indicator for the viewer.
+     * @example
+     * <DocumentView
+     *   pageIndicatorEnabled={true}
+     * />
+     */
+    pageIndicatorEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Android only.
+     *
+     * Defines whether the download dialog should be shown.
+     * @example
+     * <DocumentView
+     *    downloadDialogEnabled={true}
+     * />
+     */
+    downloadDialogEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Page
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc iOS only
+     *
+     * Defines whether the keyboard shortcuts of the viewer are enabled.
+     * @example
+     * <DocumentView
+     *   keyboardShortcutsEnabled={false}
+     * />
+     */
+    keyboardShortcutsEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when an annotation(s) is selected.
+     * @param {object[]} annotations array of annotation data in the format
+     * `{id: string, pageNumber: number, type: string,
+     * screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number},
+     * pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`,
+     * representing the selected annotations.
+     *
+     * `type` is one of the {@link Config.Tools} constants.
+     *
+     * `screenRect` was formerly called `rect`.
+     * @example
+     * <DocumentView
+     *   onAnnotationsSelected = {({annotations}) => {
+     *     annotations.forEach(annotation => {
+     *       console.log('The id of selected annotation is', annotation.id);
+     *       console.log('It is in page', annotation.pageNumber);
+     *       console.log('Its type is', annotation.type);
+     *     });
+     *   }}
+     * />
+     */
+    onAnnotationsSelected: func(),
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called if a change has been made to an annotation(s)
+     * in the current document.
+     *
+     * Note: When an annotation is flattened, it also gets deleted, so both
+     * {@link DocumentView.event:onAnnotationChanged onAnnotationChanged} and
+     * {@link DocumentView.event:onAnnotationFlattened onAnnotationFlattened} are called.
+     *
+     * @param {string} action the action that occurred (add, delete, modify)
+     * @param {object[]} annotations array of annotation data in the format
+     * `{id: string, pageNumber: number, type: string}`,
+     * representing the annotations that have been changed.
+     *
+     * `type` is one of the {@link Config.Tools} constants
+     * @example
+     * <DocumentView
+     *   onAnnotationChanged = {({action, annotations}) => {
+     *     console.log('Annotation edit action is', action);
+     *     annotations.forEach(annotation => {
+     *       console.log('The id of changed annotation is', annotation.id);
+     *       console.log('It is in page', annotation.pageNumber);
+     *       console.log('Its type is', annotation.type);
+     *     });
+     *   }}
+     * />
+     */
+    onAnnotationChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called if a change has been made to form field values.
+     * @param {object[]} fields array of field data in the format
+     * `{fieldName: string, fieldType: string, fieldValue: any}`,
+     * representing the fields that have been changed
+     * @example
+     * <DocumentView
+     *   onFormFieldValueChanged = {({fields}) => {
+     *     fields.forEach(field => {
+     *       console.log('The name of the changed field is', field.fieldName);
+     *       console.log('The type of the changed field is', field.fieldType);
+     *       console.log('The value of the changed field is', field.fieldValue);
+     *     });
+     *   }}
+     * />
+     */
+    onFormFieldValueChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called if an annotation(s) has been flattened in the
+     * current document.
+     * @param {object[]} annotations array of annotation data in the format
+     * `{id: string, pageNumber: number, type: string}`,
+     * representing the annotations that have been changed.
+     *
+     * `type` is one of the {@link Config.Tools} constants
+     *
+     * `id` returned via the event listener can be null.
+     * @example
+     * <DocumentView
+     *   onAnnotationFlattened={({annotations}) => {
+          annotations.forEach(annotation => {
+            console.log('The id of changed annotation is', annotation.id);
+            console.log('It is in page', annotation.pageNumber);
+            console.log('Its type is', annotation.type);
+          });
+        }}
+     * />
+     */
+    onAnnotationFlattened: func(),
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Defines whether the viewer is read-only.
+     * If true, the UI will not allow the user to change the document.
+     * @example
+     * <DocumentView
+     *   readOnly={true}
+     * />
+     */
+    readOnly: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Thumbnails
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether user can modify the document
+     * using the thumbnail view (eg add/remove/rotate pages).
+     * @example
+     * <DocumentView
+     *   thumbnailViewEditingEnabled={true}
+     * />
+     */
+    thumbnailViewEditingEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Layout
+     * @type {Config.FitMode}
+     * @optional
+     * @default Config.FitMode.FitWidth
+     * @desc Defines the fit mode (default zoom level) of the viewer.
+     * @example
+     * <DocumentView
+     *   fitMode={Config.FitMode.FitPage}
+     * />
+     */
+    fitMode: oneOf(Config.FitMode),
+    /**
+     * @memberof DocumentView
+     * @category Layout
+     * @type {Config.LayoutMode}
+     * @optional
+     * @default Config.LayoutMode.Continuous
+     * @desc Defines the layout mode of the viewer.
+     * @example
+     * <DocumentView
+     *   layoutMode={Config.LayoutMode.FacingContinuous}
+     * />
+     */
+    layoutMode: oneOf(Config.LayoutMode),
+    /**
+     * @memberof DocumentView
+     * @category Layout
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when the layout of the viewer has been changed.
+     * @example
+     * <DocumentView
+     *   onLayoutChanged = {() => {
+     *     console.log('Layout has been updated.');
+     *   }}
+     * />
+     */
+    onLayoutChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Android only
+     *
+     * Defines whether the viewer will add padding to take account of the system status bar.
+     * @example
+     * <DocumentView
+     *   padStatusBar={true}
+     * />
+     */
+    padStatusBar: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc 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.
+     * @example
+     * <DocumentView
+     *   continuousAnnotationEditing={true}
+     * />
+     */
+    continuousAnnotationEditing: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether an annotation is selected after it is created.
+     * On iOS, this functions for shape and text markup annotations only.
+     * @example
+     * <DocumentView
+     *   selectAnnotationAfterCreation={true}
+     * />
+     */
+    selectAnnotationAfterCreation: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @type {string}
+     * @optional
+     * @desc Defines the author name for all annotations created on the current document.
+     * Exported xfdfCommand will include this piece of information.
+     * @example
+     * <DocumentView
+     *   annotationAuthor={'PDFTron'}
+     * />
+     */
+    annotationAuthor: PropTypes.string,
+    /**
+     * @memberof DocumentView
+     * @category Signature
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether to show saved signatures for re-use when using the signing tool.
+     * @example
+     * <DocumentView
+     *   showSavedSignatures={true}
+     * />
+     */
+    showSavedSignatures: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc If true, {@link DocumentView.document document} prop will be treated as a base64 string.
+     * If it is not the base64 string of a pdf file,
+     * {@link DocumentView.base64FileExtension base64FileExtension} is required.
+     *
+     * When viewing a document initialized with a base64 string (i.e. a memory buffer),
+     * a temporary file is created on Android and iOS.
+     * @example
+     * <DocumentView
+     *   isBase64String={true}
+     *   document={'...'} // base 64 string
+     * />
+     */
+    isBase64String: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Collaboration
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Defines whether to enable realtime collaboration.
+     * If true then {@link DocumentView.currentUser currentUser} must be set as well for
+     * collaboration mode to work. Feature set may vary between local and collaboration mode.
+     * @example
+     * <DocumentView
+     *   collabEnabled={true}
+     *   currentUser={'Pdftron'}
+     * />
+     */
+    collabEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Collaboration
+     * @type {string}
+     * @desc Required if {@link DocumentView.collabEnabled collabEnabled} is set to true.
+     *
+     * Defines the current user.
+     * Created annotations will have their title (author) set to this string.
+     * @example
+     * <DocumentView
+     *   collabEnabled={true}
+     *   currentUser={'Pdftron'}
+     * />
+     */
+    currentUser: PropTypes.string,
+    /**
+     * @memberof DocumentView
+     * @category Collaboration
+     * @type {string}
+     * @optional
+     * @desc Defines the current user name.
+     * Will set the user name only if {@link DocumentView.collabEnabled collabEnabled} is true
+     * and {@link DocumentView.currentUser currentUser} is defined. This should be used only if
+     * you want the user's display name to be different than the annotation's title/author
+     * (in the case that {@link DocumentView.currentUser currentUser} is an ID rather than a
+     * human-friendly name.)
+     * @example
+     * <DocumentView
+     *   collabEnabled={true}
+     *   currentUser={'Pdftron'}
+     *   currentUserName={'Hello_World'}
+     * />
+     */
+    currentUserName: PropTypes.string,
+    /**
+     * @memberof DocumentView
+     * @category Import/Export Annotations
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called if a change has been made to annotations in the current document.
+     * Unlike {@link DocumentView.event:onAnnotationChanged onAnnotationChanged}, this function has
+     * an XFDF command string as its parameter. If you are modifying or deleting multiple annotations,
+     * then on Android the function is only called once, and on iOS it is called for each annotation.
+     *
+     * **Known Issues**
+     *
+     * On iOS, there is currently a bug that prevents the last XFDF from being retrieved when
+     * modifying annotations while collaboration mode is enabled.
+     * @param {string} action the action that occurred (add, delete, modify)
+     * @param {string} xfdfCommand an xfdf string containing info about the edit
+     * @param {array} annotations an array of annotation data.
+     * When collaboration is enabled data comes in the format `{id: string}`, otherwise the format is
+     * `{id: string, pageNumber: number, type: string}`.
+     * In both cases, the data represents the annotations that have been changed.
+     *
+     * `type` is one of the {@link Config.Tools} constants.
+     * @example
+     * <DocumentView
+     *   onExportAnnotationCommand = {({action, xfdfCommand, annotations}) => {
+     *     console.log('Annotation edit action is', action);
+     *     console.log('The exported xfdfCommand is', xfdfCommand);
+     *     annotations.forEach((annotation) => {
+     *       console.log('Annotation id is', annotation.id);
+     *     if (!this.state.collabEnabled) {
+     *         console.log('Annotation pageNumber is', annotation.pageNumber);
+     *         console.log('Annotation type is', annotation.type);
+     *       }
+     *     });
+     *     }}
+     *     collabEnabled={this.state.collabEnabled}
+     *     currentUser={'Pdftron'}
+     * />
+     */
+    onExportAnnotationCommand: func(),
+    /**
+     * @memberof DocumentView
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether document is automatically saved by the viewer.
+     * @example
+     * <DocumentView
+     *   autoSaveEnabled={true}
+     * />
+     */
+    autoSaveEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Page
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether the viewer should change pages when the user taps the edge of a page,
+     * when the viewer is in a horizontal viewing mode.
+     * @example
+     * <DocumentView
+     *   pageChangeOnTap={true}
+     * />
+     */
+    pageChangeOnTap: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Android and iOS 13+ only
+     *
+     * Defines whether the UI will appear in a dark color when the system is dark mode.
+     * If false, it will use viewer setting instead.
+     * @example
+     * <DocumentView
+     *   followSystemDarkMode={false}
+     * />
+     */
+    followSystemDarkMode: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether a stylus should act as a pen when in pan mode.
+     * If false, it will act as a finger.
+     * @example
+     * <DocumentView
+     *   useStylusAsPen={true}
+     * />
+     */
+    useStylusAsPen: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Multi-tab
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Defines whether viewer will use tabs in order to have more than
+     * one document open simultaneously (like a web browser). Changing the
+     * {@link DocumentView.document document} prop value will cause a new tab
+     * to be opened with the associated file.
+     * @example
+     * <DocumentView
+     *   multiTabEnabled={true}
+     * />
+     */
+    multiTabEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Multi-tab
+     * @type {string}
+     * @optional
+     * @default the file name
+     * @desc Set the tab title if {@link DocumentView.multiTabEnabled multiTabEnabled} is true.
+     * @example
+     * <DocumentView
+     *   multiTabEnabled={true}
+     *   tabTitle={'tab1'}
+     * />
+     */
+    tabTitle: PropTypes.string,
+    /**
+     * @memberof DocumentView
+     * @category Multi-tab
+     * @type {number}
+     * @optional
+     * @default unlimited
+     * @desc Sets the limit on the maximum number of tabs that the viewer could have at a time.
+     * Open more documents after reaching this limit will overwrite the old tabs.
+     * @example
+     * <DocumentView
+     *   multiTabEnabled={true}
+     *   maxTabCount={5}
+     * />
+     */
+    maxTabCount: PropTypes.number,
+    /**
+     * @memberof DocumentView
+     * @category Signature
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc
+     * Defines whether signature fields will be signed with image stamps.
+     * This is useful if you are saving XFDF to remote source.
+     * @example
+     * <DocumentView
+     *   signSignatureFieldsWithStamps={true}
+     * />
+     */
+    signSignatureFieldsWithStamps: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Defines whether an annotation's permission flags will be respected when it is selected.
+     * For example, a locked annotation can not be resized or moved.
+     * @example
+     * <DocumentView
+     *   annotationPermissionCheckEnabled={true}
+     * />
+     */
+    annotationPermissionCheckEnabled: PropTypes.bool,
+    /**
+     * @type {Config.DefaultToolbars[]|object}
+     * @category Toolbar Customization
+     * @memberof DocumentView
+     * @optional
+     * @default Defaults to none.
+     * @desc Type can be array of {@link Config.DefaultToolbars} constants or custom toolbar objects.
+     *
+     * Defines custom toolbars. If passed in, the default toolbars will no longer appear.
+     * It is possible to mix and match with default toolbars. See example below.
+     * @example
+     * const myToolbar = {
+     *   [Config.CustomToolbarKey.Id]: 'myToolbar',
+     *   [Config.CustomToolbarKey.Name]: 'myToolbar',
+     *   [Config.CustomToolbarKey.Icon]: Config.ToolbarIcons.FillAndSign,
+     *   [Config.CustomToolbarKey.Items]: [Config.Tools.annotationCreateArrow,
+     *      Config.Tools.annotationCreateCallout, Config.Buttons.undo]
+     * };
+     * ...
+     * <DocumentView
+     *   annotationToolbars={[Config.DefaultToolbars.Annotate, myToolbar]}
+     * />
+     */
+    annotationToolbars: PropTypes.arrayOf(PropTypes.oneOfType([
+        oneOf(Config.DefaultToolbars),
+        PropTypes.exact({
+            id: PropTypes.string.isRequired,
+            name: PropTypes.string.isRequired,
+            icon: oneOf(Config.ToolbarIcons).isRequired,
+            items: arrayOf(Config.Tools, Config.Buttons).isRequired
+        })
+    ])),
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {Config.DefaultToolbars[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc Defines which default annotation toolbars should be hidden.
+     * Note that this prop should be used when
+     * {@link DocumentView.annotationToolbars annotationToolbars} is not defined.
+     * @example
+     * <DocumentView
+     *   hideDefaultAnnotationToolbars={[Config.DefaultToolbars.Annotate,
+     *     Config.DefaultToolbars.Favorite]}
+     * />
+     */
+    hideDefaultAnnotationToolbars: arrayOf(Config.DefaultToolbars),
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {Config.Buttons[]}
+     * @optional
+     * @desc iOS only
+     *
+     * Customizes the right bar section of the top app nav bar.
+     * If passed in, the default right bar section will not be used.
+     * @example
+     * <DocumentView
+     *   topAppNavBarRightBar={[Config.Buttons.reflowButton, Config.Buttons.outlineListButton]}
+     * />
+     */
+    topAppNavBarRightBar: arrayOf(Config.Buttons),
+    /**
+     * @memberof DocumentView
+     * @type {Config.Buttons[]}
+     * @category Toolbar Customization
+     * @optional
+     * @desc Only the outline list, thumbnail list, share, view mode,
+     * search, and reflow buttons are supported on Android.
+     *
+     * Defines a custom bottom toolbar. If passed in, the default bottom toolbar will not be used.
+     * @example
+     * <DocumentView
+     *   bottomToolbar={[Config.Buttons.reflowButton, Config.Buttons.outlineListButton]}
+     * />
+    */
+    bottomToolbar: arrayOf(Config.Buttons),
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Defines whether to show the toolbar switcher in the top toolbar.
+     * @example
+     * <DocumentView
+     *   hideAnnotationToolbarSwitcher={false}
+     * />
+     */
+    hideAnnotationToolbarSwitcher: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Defines whether to hide both the top app nav bar and the annotation toolbar.
+     * @example
+     * <DocumentView
+     *   hideTopToolbars={false}
+     * />
+     */
+    hideTopToolbars: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Defines whether to hide the top navigation app bar.
+     * @example
+     * <DocumentView
+     *   hideTopAppNavBar={true}
+     * />
+     */
+    hideTopAppNavBar: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Bookmark
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called if a change has been made to user bookmarks.
+     * @param {string} bookmarkJson the list of current bookmarks in JSON format
+     * @example
+     * <DocumentView
+     *   onBookmarkChanged = {({bookmarkJson}) => {
+     *     console.log('Bookmarks have been changed. Current bookmark collection is', bookmarkJson);
+     *   }}
+     * />
+     */
+    onBookmarkChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category Thumbnails
+     * @type {Config.ThumbnailFilterMode[]}
+     * @optional
+     * @desc Defines filter modes that should be hidden in the thumbnails browser.
+     * @example
+     * <DocumentView
+     *   hideThumbnailFilterModes={[Config.ThumbnailFilterMode.Annotated]}
+     * />
+     */
+    hideThumbnailFilterModes: arrayOf(Config.ThumbnailFilterMode),
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when the current tool changes to a new tool
+     * @param {Config.Tools|string} previousTool the previous tool
+     * (one of the {@link Config.Tools} constants or "unknown tool"),
+     * representing the tool before change
+     * @param {Config.Tools|string} tool the current tool (one of the {@link Config.Tools} constants
+     * or "unknown tool"), representing the current tool
+     * @example
+     * <DocumentView
+     *   onToolChanged = {({previousTool, tool}) => {
+     *     console.log('Tool has been changed from', previousTool, 'to', tool);
+     *   }}
+     * />
+     */
+    onToolChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category Scroll
+     * @type {number}
+     * @optional
+     * @desc Defines the horizontal scroll position in the current document viewer.
+     * @example
+     * <DocumentView
+     *   horizontalScrollPos={50}
+     * />
+     */
+    horizontalScrollPos: PropTypes.number,
+    /**
+     * @memberof DocumentView
+     * @category Scroll
+     * @type {number}
+     * @optional
+     * @desc Defines the vertical scroll position in the current document viewer.
+     * @example
+     * <DocumentView
+     *   verticalScrollPos={50}
+     * />
+     */
+    verticalScrollPos: PropTypes.number,
+    /**
+     * @memberof DocumentView
+     * @category Text Selection
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called immediately before a text search begins,
+     * either through user actions, or function calls such as {@link DocumentView#findText findText}.
+     * @example
+     * <DocumentView
+     *   onTextSearchStart = {() => {
+     *     console.log('Text search has started');
+     *   }}
+     * />
+     */
+    onTextSearchStart: func(),
+    /**
+     * @memberof DocumentView
+     * @category Text Selection
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called after a text search is finished or canceled.
+     * @param {boolean} found whether a result is found.
+     * If false, it could be caused by not finding a matching result in the document,
+     * invalid text input, or action cancellation
+     * (user actions or {@link DocumentView#cancelFindText cancelFindText})
+     * @param {object} textSelection the text selection, in the format
+     * `{html: string, unicode: string, pageNumber: number,
+     * quads: [[{x: number, y: number}, {x: number, y: number}, {x: number, y: number},
+     * {x: number, y: number}], ...]}`. If no such selection could be found, this would be null
+     *
+     * Quads indicate the quad boundary boxes for the selection,
+     * which could have a size larger than 1 if selection spans across different lines.
+     * Each quad have 4 points with x, y coordinates specified in number, representing a boundary box.
+     * The 4 points are in counter-clockwise order, though the first point is not guaranteed to be on
+     * lower-left relatively to the box.
+     * @example
+     * <DocumentView
+     *   onTextSearchResult = {({found, textSelection}) => {
+     *     if (found) {
+     *       console.log('Found selection on page', textSelection.pageNumber);
+     *       for (let i = 0; i < textSelection.quads.length; i ++) {
+     *         const quad = textSelection.quads[i];
+     *         console.log('selection boundary quad', i);
+     *         for (const quadPoint of quad) {
+     *           console.log('A quad point has coordinates', quadPoint.x, quadPoint.y);
+     *         }
+     *       }
+     *     }
+     *   }}
+     * />
+     */
+    onTextSearchResult: func(),
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {Config.ViewModePickerItem[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc Defines view mode items to be hidden in the view mode dialog.
+     * @example
+     * <DocumentView
+     *   hideViewModeItems={[
+     *     Config.ViewModePickerItem.Crop,
+     *     Config.ViewModePickerItem.Rotation,
+     *     Config.ViewModePickerItem.ColorMode
+     *   ]}
+     * />
+     */
+    hideViewModeItems: arrayOf(Config.ViewModePickerItem),
+    /**
+     * @memberof DocumentView
+     * @category Navigation
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @deprecated Use the {@link DocumentView.showQuickNavigationButton showQuickNavigationButton}
+     * prop instead.
+     * @desc Android only.
+     *
+     * Defines whether the page stack navigation buttons will appear in the viewer.
+     * @example
+     * <DocumentView
+     *   pageStackEnabled={false}
+     * />
+     */
+    pageStackEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Navigation
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether the quick navigation buttons will appear in the viewer.
+     * @example
+     * <DocumentView
+     *   showQuickNavigationButton={false}
+     * />
+     */
+    showQuickNavigationButton: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Signature
+     * @type {boolean}
+     * @optional
+     * @default true.
+     * @desc Android only.
+     *
+     * Defines whether to show the option to pick images in the signature dialog.
+     * @example
+     * <DocumentView
+     *   photoPickerEnabled={true}
+     * />
+     */
+    photoPickerEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Defines whether to automatically resize the bounding box of free
+     * text annotations when editing.
+     * @example
+     * <DocumentView
+     *   autoResizeFreeTextEnabled={true}
+     * />
+     */
+    autoResizeFreeTextEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc If document editing is enabled, then this value determines
+     * if the annotation list is editable.
+     * @example
+     * <DocumentView
+     *   annotationsListEditingEnabled={true}
+     * />
+     */
+    annotationsListEditingEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Navigation
+     * @type {boolean}
+     * @optional
+     * @default true on Android and false on iOS
+     * @desc Defines whether the navigation list will be displayed as a side panel
+     * on large devices such as iPads and tablets.
+     * @example
+     * <DocumentView
+     *   showNavigationListAsSidePanelOnLargeDevices={true}
+     * />
+     */
+    showNavigationListAsSidePanelOnLargeDevices: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc Defines whether to restrict data usage when viewing online PDFs.
+     * @example
+     * <DocumentView
+     *   restrictDownloadUsage={true}
+     * />
+     */
+    restrictDownloadUsage: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Bookmark
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Defines whether the bookmark list can be edited.
+     * If the viewer is readonly then bookmarks on Android are
+     * still editable but are saved to the device rather than the PDF.
+     * @example
+     * <DocumentView
+     *   userBookmarksListEditingEnabled={true}
+     * />
+     */
+    userBookmarksListEditingEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Reflow
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Will be available on iOS in version 9.1.2 and greater
+     *
+     * Whether to show images in reflow mode.
+     * @example
+     * <DocumentView
+     *   imageInReflowEnabled={false}
+     * />
+     */
+    imageInReflowEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Reflow
+     * @type {Config.ReflowOrientation}
+     * @optional
+     * @default Defaults to the viewer's scroll direction
+     * @desc Android only.
+     *
+     * Sets the scrolling direction of the reflow control.
+     * @example
+     * <DocumentView
+     *   reflowOrientation={Config.ReflowOrientation.Vertical}
+     * />
+     */
+    reflowOrientation: oneOf(Config.ReflowOrientation),
+    /**
+     * @memberof DocumentView
+     * @category Undo/Redo
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when the state of the current document's
+     * undo/redo stack has been changed.
+     * @example
+     * <DocumentView
+     *   onUndoRedoStateChanged = {() => {
+     *     console.log("Undo/redo stack state changed");
+     *   }}
+     * />
+     */
+    onUndoRedoStateChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Android only.
+     *
+     * Defines whether the tablet layout should be used on tablets.
+     * Otherwise uses the same layout as phones.
+     * @example
+     * <DocumentView
+     *   tabletLayoutEnabled={true}
+     * />
+     */
+    tabletLayoutEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Toolbar Customization
+     * @type {Config.DefaultToolbars|string}
+     * @optional
+     * @default Defaults to none.
+     * @desc Type can be one of the {@link Config.DefaultToolbars} constants
+     * or the `id` of a custom toolbar object.
+     *
+     * Defines which {@link DocumentView.annotationToolbars annotationToolbar}
+     * should be selected when the document is opened.
+     * @example
+     * <DocumentView
+     *   initialToolbar={Config.DefaultToolbars.Draw}
+     * />
+     */
+    initialToolbar: PropTypes.string,
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc If true, ink tool will use multi-stroke mode.
+     * Otherwise, each stroke is a new ink annotation.
+     * @example
+     * <DocumentView
+     *   inkMultiStrokeEnabled={true}
+     * />
+     */
+    inkMultiStrokeEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {Config.EraserType}
+     * @optional
+     * @desc Sets the default eraser tool type. Value only applied after a clean
+     * install.
+     * Eraser Type | Description
+     * --- | ---
+     * `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.
+     * @example
+     * <DocumentView
+     *   defaultEraserType={Config.EraserType.hybrideEraser}
+     * />
+     */
+    defaultEraserType: oneOf(Config.EraserType),
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {string}
+     * @optional
+     * @desc Android only.
+     *
+     * Sets the folder path for all save options, this defaults to the app cache path.
+     * Example:
+     * @example
+     * <DocumentView
+     *   exportPath="/data/data/com.example/cache/test"
+     * />
+     */
+    exportPath: PropTypes.string,
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {string}
+     * @optional
+     * @desc Android only.
+     *
+     * Sets the cache folder used to cache PDF files opened using a http/https link,
+     * this defaults to the app cache path.
+     * @example
+     * <DocumentView
+     *   openUrlPath="/data/data/com.example/cache/test"
+     * />
+     */
+    openUrlPath: PropTypes.string,
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @type {Config.Tools[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc Defines annotation types that cannot be edited after creation.
+     * @example
+     * <DocumentView
+     *   disableEditingByAnnotationType={[Config.Tools.annotationCreateTextSquiggly,
+     *     Config.Tools.annotationCreateEllipse]}
+     * />
+     */
+    disableEditingByAnnotationType: arrayOf(Config.Tools),
+    /**
+     * @memberof DocumentView
+     * @category Scroll
+     * @type {boolean}
+     * @optional
+     * @default false
+     * @desc iOS only.
+     *
+     * Determines whether scrollbars will be hidden on the viewer.
+     * @example
+     * <DocumentView
+     *   hideScrollbars={true}
+     * />
+     */
+    hideScrollbars: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Sets whether to remember the last visited page and zoom for a
+     * document if it gets opened again.
+     * @example
+     * <DocumentView
+     *   saveStateEnabled={false}
+     * />
+     */
+    saveStateEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Open a Document
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Android only.
+     *
+     * Sets whether the new saved file should open after saving.
+     * @example
+     * <DocumentView
+     *   openSavedCopyInNewTab={false}
+     * />
+     */
+    openSavedCopyInNewTab: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Annotations
+     * @type {Config.Tools[]}
+     * @optional
+     * @default Defaults to none.
+     * @desc Defines types to be excluded from the annotation list.
+     * @example
+     * <DocumentView
+     *   excludedAnnotationListTypes={[Config.Tools.annotationCreateEllipse,
+     *     Config.Tools.annotationCreateRectangle,
+     *     Config.Tools.annotationCreateRedaction]}
+     * />
+     */
+    excludedAnnotationListTypes: arrayOf(Config.Tools),
+    /**
+     * @memberof DocumentView
+     * @category Collaboration
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Android only.
+     *
+     * Defines whether to show an annotation's reply review state.
+     * @example
+     * <DocumentView
+     *   collabEnabled={true}
+     *   currentUser={'Pdftron'}
+     *   replyReviewStateEnabled={true}
+     * />
+     */
+    replyReviewStateEnabled: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category Collaboration
+     * @type {Config.AnnotationManagerEditMode}
+     * @optional
+     * @default Config.AnnotationManagerEditMode.Own
+     * @desc Sets annotation manager edit mode when {@link DocumentView.collabEnabled collabEnabled}
+     * is true.
+     *
+     * Mode | Description
+     * --- | ---
+     * `Config.AnnotationManagerEditMode.Own` | In this mode, you can edit only your own changes
+     * `Config.AnnotationManagerEditMode.All` | In this mode, you can edit everyone's changes
+     * @example
+     * <DocumentView
+     *   collabEnabled={true}
+     *   currentUser={'Pdftron'}
+     *   annotationManagerEditMode={Config.AnnotationManagerEditMode.Own}
+     * />
+     */
+    annotationManagerEditMode: oneOf(Config.AnnotationManagerEditMode),
+    /**
+     * @memberof DocumentView
+     * @category Collaboration
+     * @type {Config.AnnotationManagerUndoMode}
+     * @optional
+     * @default Config.AnnotationManagerUndoMode.Own
+     * @desc Sets annotation manager undo mode when {@link DocumentView.collabEnabled collabEnabled}
+     * is true.
+     *
+     * Mode | Description
+     * --- | ---
+     * `Config.AnnotationManagerUndoMode.Own` | In this mode, you can undo only your own changes
+     * `Config.AnnotationManagerUndoMode.All` | In this mode, you can undo everyone's changes
+     * @example
+     * <DocumentView
+     *   collabEnabled={true}
+     *   currentUser={'Pdftron'}
+     *   annotationManagerUndoMode={Config.AnnotationManagerUndoMode.Own}
+     * />
+     */
+    annotationManagerUndoMode: oneOf(Config.AnnotationManagerUndoMode),
+    /**
+     * @memberof DocumentView
+     * @category Page
+     * @event
+     * @type {function}
+     * @optional
+     * @desc This function is called when a page has been moved in the document.
+     * @param {int} previousPageNumber the previous page number
+     * @param {int} pageNumber the current page number
+     * @example
+     * <DocumentView
+     *   onPageMoved = {({previousPageNumber, pageNumber}) => {
+     *     console.log('Page moved from', previousPageNumber, 'to', pageNumber);
+     *   }}
+     * />
+     */
+    onPageMoved: func(),
+    /**
+     * @memberof DocumentView
+     * @category Multi-tab
+     * @event
+     * @type {function}
+     * @optional
+     * @desc The function is activated when a tab is changed.
+     *
+     * This API is meant for tab-specific changes.
+     * If you would like to know when the document finishes loading instead, see
+     * the {@link DocumentView.event:onDocumentLoaded onDocumentLoaded} event.
+     * @param {string} currentTab The file path of current tab's document
+     * @example
+     * <DocumentView
+     *   multiTabEnabled={true}
+     *   onTabChanged={({currentTab}) => {
+     *     console.log("The current tab is ", currentTab);
+     *   }}
+     * />
+     */
+    onTabChanged: func(),
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {boolean}
+     * @optional
+     * @default true
+     * @desc Android only.
+     *
+     * Defines whether the last tool used in the current viewer session will
+     * be the tool selected upon starting a new viewer session.
+     * @example
+     * <DocumentView
+     *   rememberLastUsedTool={true}
+     * />
+     */
+    rememberLastUsedTool: PropTypes.bool,
+    /**
+     * @memberof DocumentView
+     * @category UI Customization
+     * @type {string}
+     * @optional
+     * @desc The file name of the icon to be used as the overflow menu button.
+     * The button will use the specified icon if it is valid, and the default icon otherwise.
+     *
+     * **Note**: to add the image file to your application, follow the steps under the Note
+     * section of {@link DocumentView.leadingNavButtonIcon leadingNavButtonIcon}.
+     * @example
+     * let iosButton = 'ic_close_black_24px.png';
+     * let androidButton = 'ic_arrow_back_white_24dp';
+     * <DocumentView
+     *  overflowMenuButtonIcon={Platform.OS === 'ios' ? iosButton : androidButton}
+     * />
+     */
+    overflowMenuButtonIcon: PropTypes.string,
+    ...ViewPropTypes,
+};
+/**
+* Creates a custom PropType for functions.
+*
+* If the resulting PropType is used to generate prop types for TS users,
+* type checking for function parameters and return values will be provided.
+* @returns {Requireable<T>} A custom PropType constant.
+* @example
+* func<(path: string) => void>()
+* @ignore
+*/
+function func() {
+    const validator = function (props, propName, componentName, location, propFullName) {
+        if (typeof props[propName] !== "function" && typeof props[propName] !== "undefined") {
+            return new Error(`Invalid prop \`${propName}\` of type \`${typeof props[propName]}\` 
+      supplied to \`${componentName}\`, expected a function.`);
+        }
+        return null;
+    };
+    const t = validator;
+    t.isRequired = validator;
+    return t;
+}
+/**
+ * Creates a custom PropType representing any value from given object(s).
+ * @param {object} obj An object containing values.
+ * @param {...object} rest Indefinite number of other objects containing values.
+ * @returns {Requireable<T>} A custom PropType constant.
+ * @example
+ * oneOf<Config.Tools>(Config.Tools)
+ * oneOf<Config.Tools | Config.Buttons>(Config.Tools, Config.Buttons)
+ * @ignore
+ */
+function oneOf(obj, ...rest) {
+    if (rest.length > 0) {
+        return PropTypes.oneOf(Object.values(Object.assign({}, obj, ...rest)));
+    }
+    return PropTypes.oneOf(Object.values(obj));
+}
+/**
+ * Creates a custom PropType representing any array containing values from given object(s).
+ * @param {object} obj An object containing values.
+ * @param {...object} rest Indefinite number of other objects containing values.
+ * @returns {Requireable<T[]>} A custom PropType constant.
+ * @example
+ * arrayOf<Config.Tools>(Config.Tools)
+ * arrayOf<Config.Tools | Config.Buttons>(Config.Tools, Config.Buttons)
+ * @ignore
+*/
+function arrayOf(obj, ...rest) {
+    return PropTypes.arrayOf(oneOf(obj, ...rest));
+}
+/**
+  * @class
+  * @classdesc An all-in-one React component for displaying and editing documents of different types
+  * such as PDF, docx, pptx, xlsx and various image formats.
+  *
+  * Due to the length of the source file, we have included links to the exact lines of the source
+  * code where these APIs have been implemented.
+  * @hideconstructor
+  */
+export class DocumentView extends PureComponent {
+    _viewerRef;
+    static propTypes = Object.assign(DocumentViewPropTypes, { ...ViewPropTypes });
+    onChange = (event) => {
+        if (event.nativeEvent.onLeadingNavButtonPressed) {
+            if (this.props.onLeadingNavButtonPressed) {
+                this.props.onLeadingNavButtonPressed();
+            }
+        }
+        else if (event.nativeEvent.onDocumentLoaded) {
+            if (this.props.onDocumentLoaded) {
+                this.props.onDocumentLoaded(event.nativeEvent.onDocumentLoaded);
+            }
+        }
+        else if (event.nativeEvent.onPageChanged) {
+            if (this.props.onPageChanged) {
+                this.props.onPageChanged({
+                    'previousPageNumber': event.nativeEvent.previousPageNumber,
+                    'pageNumber': event.nativeEvent.pageNumber
+                });
+            }
+        }
+        else if (event.nativeEvent.onScrollChanged) {
+            if (this.props.onScrollChanged) {
+                this.props.onScrollChanged({
+                    'horizontal': event.nativeEvent.horizontal,
+                    'vertical': event.nativeEvent.vertical
+                });
+            }
+        }
+        else if (event.nativeEvent.onZoomChanged) {
+            if (this.props.onZoomChanged) {
+                this.props.onZoomChanged({
+                    'zoom': event.nativeEvent.zoom
+                });
+            }
+        }
+        else if (event.nativeEvent.onZoomFinished) {
+            if (this.props.onZoomFinished) {
+                this.props.onZoomFinished({
+                    'zoom': event.nativeEvent.zoom
+                });
+            }
+        }
+        else if (event.nativeEvent.onLayoutChanged) {
+            if (this.props.onLayoutChanged) {
+                this.props.onLayoutChanged();
+            }
+        }
+        else if (event.nativeEvent.onAnnotationChanged) {
+            if (this.props.onAnnotationChanged) {
+                this.props.onAnnotationChanged({
+                    'action': event.nativeEvent.action,
+                    'annotations': event.nativeEvent.annotations
+                });
+            }
+        }
+        else if (event.nativeEvent.onAnnotationFlattened) {
+            if (this.props.onAnnotationFlattened) {
+                this.props.onAnnotationFlattened({
+                    'annotations': event.nativeEvent.annotations
+                });
+            }
+        }
+        else if (event.nativeEvent.onAnnotationsSelected) {
+            if (this.props.onAnnotationsSelected) {
+                this.props.onAnnotationsSelected({
+                    'annotations': event.nativeEvent.annotations
+                });
+            }
+        }
+        else if (event.nativeEvent.onFormFieldValueChanged) {
+            if (this.props.onFormFieldValueChanged) {
+                this.props.onFormFieldValueChanged({
+                    'fields': event.nativeEvent.fields
+                });
+            }
+        }
+        else if (event.nativeEvent.onDocumentError) {
+            if (this.props.onDocumentError) {
+                this.props.onDocumentError(event.nativeEvent.onDocumentError);
+            }
+            else {
+                const error = 'Unknown error';
+                const msg = event.nativeEvent.onDocumentError ? event.nativeEvent.onDocumentError : error;
+                Alert.alert('Alert', msg, [
+                    { text: 'OK' }
+                ], { cancelable: true });
+            }
+        }
+        else if (event.nativeEvent.onExportAnnotationCommand) {
+            if (this.props.onExportAnnotationCommand) {
+                this.props.onExportAnnotationCommand({
+                    'action': event.nativeEvent.action,
+                    'xfdfCommand': event.nativeEvent.xfdfCommand,
+                    'annotations': event.nativeEvent.annotations
+                });
+            }
+        }
+        else if (event.nativeEvent.onAnnotationMenuPress) {
+            if (this.props.onAnnotationMenuPress) {
+                this.props.onAnnotationMenuPress({
+                    'annotationMenu': event.nativeEvent.annotationMenu,
+                    'annotations': event.nativeEvent.annotations
+                });
+            }
+        }
+        else if (event.nativeEvent.onLongPressMenuPress) {
+            if (this.props.onLongPressMenuPress) {
+                this.props.onLongPressMenuPress({
+                    'longPressMenu': event.nativeEvent.longPressMenu,
+                    'longPressText': event.nativeEvent.longPressText
+                });
+            }
+        }
+        else if (event.nativeEvent.onBehaviorActivated) {
+            if (this.props.onBehaviorActivated) {
+                this.props.onBehaviorActivated({
+                    'action': event.nativeEvent.action,
+                    'data': event.nativeEvent.data
+                });
+            }
+        }
+        else if (event.nativeEvent.onBookmarkChanged) {
+            if (this.props.onBookmarkChanged) {
+                this.props.onBookmarkChanged({
+                    'bookmarkJson': event.nativeEvent.bookmarkJson
+                });
+            }
+        }
+        else if (event.nativeEvent.onToolChanged) {
+            if (this.props.onToolChanged) {
+                this.props.onToolChanged({
+                    'previousTool': event.nativeEvent.previousTool,
+                    'tool': event.nativeEvent.tool
+                });
+            }
+        }
+        else if (event.nativeEvent.onTextSearchStart) {
+            if (this.props.onTextSearchStart) {
+                this.props.onTextSearchStart();
+            }
+        }
+        else if (event.nativeEvent.onTextSearchResult) {
+            if (this.props.onTextSearchResult) {
+                this.props.onTextSearchResult({
+                    'found': event.nativeEvent.found,
+                    'textSelection': event.nativeEvent.textSelection
+                });
+            }
+        }
+        else if (event.nativeEvent.onUndoRedoStateChanged) {
+            if (this.props.onUndoRedoStateChanged) {
+                this.props.onUndoRedoStateChanged();
+            }
+        }
+        else if (event.nativeEvent.onPageMoved) {
+            if (this.props.onPageMoved) {
+                this.props.onPageMoved({
+                    'previousPageNumber': event.nativeEvent.previousPageNumber,
+                    'pageNumber': event.nativeEvent.pageNumber
+                });
+            }
+        }
+        else if (event.nativeEvent.onTabChanged) {
+            if (this.props.onTabChanged) {
+                this.props.onTabChanged({
+                    'currentTab': event.nativeEvent.currentTab
+                });
+            }
+        }
+    };
+    // Methods
+    /**
+     * @method
+     * @category Document
+     * @desc Returns the path of the current document.
+     * If {@link DocumentView.isBase64String isBase64String} is true,
+     * this would be the path to the temporary pdf file converted from
+     * the base64 string in {@link DocumentView.document document}.
+     * @returns {Promise<void | string>} path - the document path.
+     * @example
+     * this._viewer.getDocumentPath().then((path) => {
+     *   console.log('The path to current document is: ' + path);
+     * });
+     */
+    getDocumentPath = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getDocumentPath(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotation Tools
+     * @desc Sets the current tool mode.
+     * @param {Config.Tools} toolMode the tool mode to set.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.setToolMode(Config.Tools.annotationCreateFreeHand).then(() => {
+     *   // done switching tools
+     * });
+     */
+    setToolMode = (toolMode) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setToolMode(tag, toolMode);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotation Tools
+     * @desc Commits the current tool, only available for multi-stroke ink and poly-shape.
+     * @returns {Promise<void | boolean>} committed - true if either ink or poly-shape tool is
+     * committed, false otherwise
+     * @example
+     * this._viewer.commitTool().then((committed) => {
+     *   // committed: true if either ink or poly-shape tool is committed, false otherwise
+     * });
+     */
+    commitTool = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.commitTool(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Gets the current page count of the document.
+     * @returns {Promise<void | number>} pageCount - the current page count of the document
+     * @example
+     * this._viewer.getPageCount().then((pageCount) => {
+     *   console.log('pageCount', pageCount);
+     * });
+     */
+    getPageCount = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getPageCount(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Bookmark
+     * @desc Imports user bookmarks into the document.
+     * The input needs to be a valid bookmark JSON format.
+     * @param {string} bookmarkJson needs to be in valid bookmark JSON format,
+     * for example {"0": "Page 1"}. The page numbers are 1-indexed
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.importBookmarkJson("{\"0\": \"Page 1\", \"3\": \"Page 4\"}");
+     */
+    importBookmarkJson = (bookmarkJson) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.importBookmarkJson(tag, bookmarkJson);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Bookmark
+     * @desc Displays the bookmark tab of the existing list container.
+     * If this tab has been disabled, the method does nothing.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.openBookmarkList();
+     */
+    openBookmarkList = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.openBookmarkList(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Import/Export Annotations
+     * @desc Imports remote annotation command to local document.
+     * @param {string} xfdfCommand the XFDF command string
+     * @param {boolean} [initialLoad=false] whether this is for initial load.
+     * @returns {Promise<void>}
+     * @example
+     * const 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>';
+     * this._viewer.importAnnotationCommand(xfdfCommand);
+     */
+    importAnnotationCommand = (xfdfCommand, initialLoad) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            if (initialLoad === undefined) {
+                initialLoad = false;
+            }
+            return DocumentViewManager.importAnnotationCommand(tag, xfdfCommand, initialLoad);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Import/Export Annotations
+     * @desc Imports XFDF annotation string to the current document.
+     * @param {string} xfdf annotation string in XFDF format for import
+     * @returns {Promise<void>}
+     * @example
+     * const 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>';
+     * this._viewer.importAnnotations(xfdf);
+     */
+    importAnnotations = (xfdf) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.importAnnotations(tag, xfdf);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Import/Export Annotations
+     * @desc Extracts XFDF from the current document.
+     * @param {object} options key: annotList, type: array.
+     * If specified, annotations with the matching id and pageNumber will be exported;
+     * otherwise, all annotations in the current document will be exported.
+     * @returns {Promise<void | string>} xfdf - annotation string in XFDF format
+     * @example <caption>Without options:</caption>
+     * this._viewer.exportAnnotations().then((xfdf) => {
+     *   console.log('XFDF for all annotations:', xfdf);
+     * });
+     * @example <caption>With options:</caption>
+     * // annotList is an array of annotation data in the format {id: string, pageNumber: int}
+     * const annotations = [{id: 'annot1', pageNumber: 1}, {id: 'annot2', pageNumber: 3}];
+     * this._viewer.exportAnnotations({annotList: annotations}).then((xfdf) => {
+     *   console.log('XFDF for 2 specified annotations', xfdf);
+     * });
+     */
+    exportAnnotations = (options) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.exportAnnotations(tag, options);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Flattens the forms and (optionally) annotations in the current document.
+     * @param {boolean} formsOnly Defines whether only forms are flattened.
+     * If false, all annotations will be flattened.
+     * @returns {Promise<void>}
+     * @example
+     * // flatten forms and annotations in the current document.
+     * this._viewer.flattenAnnotations(false);
+     */
+    flattenAnnotations = (formsOnly) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.flattenAnnotations(tag, formsOnly);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Deletes the specified annotations in the current document.
+     * @param {object[]} annotations Defines which annotation to be deleted.
+     * Each element is in the format {id: string, pageNumber: int}
+     * @returns {Promise<void>}
+     * @example
+     * // delete annotations in the current document.
+     * this._viewer.deleteAnnotations([
+     *     {
+     *         id: 'annotId1',
+     *         pageNumber: 1,
+     *     },
+     *     {
+     *         id: 'annotId2',
+     *         pageNumber: 2,
+     *     }
+     * ]);
+     */
+    deleteAnnotations = (annotations) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.deleteAnnotations(tag, annotations);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Document
+     * @desc Saves the current document.
+     * If {@link DocumentView.isBase64String isBase64String} is true,
+     * this would be the base64 string encoded from the temporary pdf file,
+     * which is created from the base64 string in {@link DocumentView.document document}.
+     * @returns {Promise<void | string>} filePath - the location of the saved document,
+     * or the base64 string of the pdf in the case of base64
+     * @example
+     * this._viewer.saveDocument().then((filePath) => {
+     *   console.log('saveDocument:', filePath);
+     * });
+     */
+    saveDocument = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.saveDocument(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Sets a field flag value on one or more form fields.
+     * @param {string[]} fields list of field names for which the flag should be set
+     * @param {Config.FieldFlags} flag flag to be set
+     * @param {boolean} value value to set for flag
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.setFlagForFields(['First Name', 'Last Name'], Config.FieldFlags.ReadOnly, true);
+     */
+    setFlagForFields = (fields, flag, value) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setFlagForFields(tag, fields, flag, value);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Get type and value information of a field using its name.
+     * @param {string} fieldName name of the field
+     * @returns {Promise<void | object>} field - an object with information keys:
+     * `fieldName`, `fieldValue` (undefined for fields with no values) and
+     * `fieldType`(one of button, checkbox, radio, text, choice,  signature and unknown),
+     * or undefined if such field does not exist
+     *
+     * @example
+     * this._viewer.getField('someFieldName').then((field) => {
+     *   if (field !== undefined) {
+     *     console.log('field name:', field.fieldName);
+     *     console.log('field value:', field.fieldValue);
+     *     console.log('field type:', field.fieldType);
+     *   }
+     * });
+     */
+    getField = (fieldName) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getField(tag, fieldName);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Displays the annotation tab of the existing list container.
+     * If this tab has been disabled, the method does nothing.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.openAnnotationList();
+     */
+    openAnnotationList = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.openAnnotationList(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+    * @method
+    * @deprecated Note: this function exists for supporting the old version.
+    * It simply calls {@link DocumentView#setValuesForFields setValuesForFields}.
+    * @ignore
+    */
+    setValueForFields = (fieldsMap) => {
+        return this.setValuesForFields(fieldsMap);
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Sets field values on one or more form fields.
+     *
+     * Note: the old function `setValueForFields` is deprecated. Please use this one instead.
+     * @param {object} fieldsMap map of field names and values which should be set
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.setValuesForFields({
+     *   'textField1': 'Test',
+     *   'textField2': 1234,
+     *   'checkboxField1': true,
+     *   'checkboxField2': false,
+     *   'radioButton1': 'Yes',
+     *   'radioButton2': 'No'
+     * });
+     */
+    setValuesForFields = (fieldsMap) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setValuesForFields(tag, fieldsMap);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Navigation
+     * @desc Handles the back button in search mode. Android only.
+     * @returns {Promise<void | boolean>} handled - whether the back button is handled successfully
+     * @example
+     * this._viewer.handleBackButton().then((handled) => {
+     *   if (!handled) {
+     *     BackHandler.exitApp();
+     *   }
+     * });
+     */
+    handleBackButton = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.handleBackButton(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+    * @method
+    * @deprecated Note: this function exists for supporting the old version.
+    * It simply calls {@link DocumentView#setFlagsForAnnotations setFlagsForAnnotations}.
+    * @ignore
+    */
+    setFlagForAnnotations = (annotationFlagList) => {
+        return this.setFlagsForAnnotations(annotationFlagList);
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Sets flags for specified annotations in the current document.
+     * The `flagValue` controls whether a flag will be set to or removed from the annotation.
+     *
+     * Note: the old function `setFlagForAnnotations` is deprecated. Please use this one.
+     *
+     * @param {object[]} annotationFlagList A list of annotation flag operations.
+     * Each element is in the format
+     * `{id: string, pageNumber: int,
+     * flag: One of {@link Config.AnnotationFlags} constants, flagValue: boolean}`
+     * @returns {Promise<void>}
+     * @example
+     * //  Set flag for annotations in the current document.
+     * this._viewer.setFlagsForAnnotations([
+     *     {
+     *         id: 'annotId1',
+     *         pageNumber: 1,
+     *         flag: Config.AnnotationFlags.noView,
+     *         flagValue: true
+     *     },
+     *     {
+     *         id: 'annotId2',
+     *         pageNumber: 5,
+     *         flag: Config.AnnotationFlags.lockedContents,
+     *         flagValue: false
+     *     }
+     * ]);
+     */
+    setFlagsForAnnotations = (annotationFlagList) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setFlagsForAnnotations(tag, annotationFlagList);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Selects the specified annotation in the current document.
+     * @param {string} id the id of the target annotation
+     * @param {integer} pageNumber the page number where the targe annotation is located.
+     * It is 1-indexed.
+     * @returns {Promise<void>}
+     * @example
+     * // select annotation in the current document.
+     * this._viewer.selectAnnotation('annotId1', 1);
+     */
+    selectAnnotation = (id, pageNumber) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.selectAnnotation(tag, id, pageNumber);
+        }
+        return Promise.resolve();
+    };
+    /**
+    * @method
+    * @deprecated Note: this function exists for supporting the old version.
+    * It simply calls setPropertiesForAnnotation.
+    * @ignore
+    */
+    setPropertyForAnnotation = (id, pageNumber, propertyMap) => {
+        return this._viewerRef.setPropertiesForAnnotation(id, pageNumber, propertyMap);
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Sets properties for specified annotation in the current document, if it is valid.
+     *
+     * Note: the old function `setPropertyForAnnotation` is deprecated. Please use this one.
+     *
+     * @param {string} annotationId the unique id of the annotation
+     * @param {integer} pageNumber the page number where annotation is located. It is 1-indexed
+     * @param {object} propertyMap an object containing properties to be set.
+     * Available properties are listed below.
+     *
+     * Properties in propertyMap:
+     *
+     * Name | Type | Markup exclusive | Example
+     * --- | --- | --- | ---
+     * rect | object | no | {x1: 1, y1: 2, x2: 3, y2: 4}
+     * contents | string | no | "contents"
+     * subject | string | yes | "subject"
+     * title | string | yes | "title"
+     * contentRect | object | yes | {x1: 1, y1: 2, x2: 3, y2: 4}
+     * customData | object | no | {key: value}
+     * strokeColor | object | no | {red: 255, green: 0, blue: 0}
+     *
+     * @returns {Promise<void>}
+     * @example
+     * // Set properties for annotation in the current document.
+     * this._viewer.setPropertiesForAnnotation('Pdftron', 1, {
+     *   rect: {
+     *     x1: 1.1,    // left
+     *     y1: 3,      // bottom
+     *     x2: 100.9,  // right
+     *     y2: 99.8    // top
+     *   },
+     *   contents: 'Hello World',
+     *   subject: 'Sample',
+     *   title: 'set-prop-for-annot',
+     *   customData: {
+     *     key1: 'value1',
+     *     key2: 'value2',
+     *     key3: 'value3'
+     *   },
+     *   strokeColor: {
+     *     "red": 255,
+     *     "green": 0,
+     *     "blue": 0
+     *   }
+     * });
+     */
+    setPropertiesForAnnotation = (id, pageNumber, propertyMap) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setPropertiesForAnnotation(tag, id, pageNumber, propertyMap);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Gets properties for specified annotation in the current document, if it is valid.
+     *
+     * @param {string} annotationId the unique id of the annotation
+     * @param {integer} pageNumber the page number where annotation is located. It is 1-indexed
+     * @returns {Promise<void | object>} propertyMap - the non-null properties of the annotation
+     *
+     * Name | Type | Markup exclusive | Example
+     * --- | --- | --- | ---
+     * rect | object | no | {x1: 1, y1: 1, x2: 2, y2: 2, width: 1, height: 1}
+     * contents | string | no | "Contents"
+     * subject | string | yes | "Subject"
+     * title | string | yes | "Title"
+     * contentRect | object | yes | {x1: 1, y1: 1, x2: 2, y2: 2, width: 1, height: 1}
+     * strokeColor | object | no | {red: 255, green: 0, blue: 0}
+     * @example
+     * // Get properties for annotation in the current document.
+     * this._viewer.getPropertiesForAnnotation('Pdftron', 1).then((properties) => {
+     *   if (properties) {
+     *     console.log('Properties for annotation: ', properties);
+     *   }
+     * })
+     */
+    getPropertiesForAnnotation = (id, pageNumber) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getPropertiesForAnnotation(tag, id, pageNumber);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Sets whether all annotations and forms should be rendered.
+     * This method affects the viewer and does not change the document.
+     *
+     * Unlike {@link DocumentView#setVisibilityForAnnotation setVisibilityForAnnotation},
+     * this method is used to show and hide all annotations and forms in the viewer.
+     * @param {boolean} drawAnnotations whether all annotations and forms should be rendered
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.setDrawAnnotations(false);
+     */
+    setDrawAnnotations = (drawAnnotations) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setDrawAnnotations(tag, drawAnnotations);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Sets visibility for specified annotation in the current document, if it is valid.
+     * Note that if {@link DocumentView#setDrawAnnotations drawAnnotations}
+     * is set to false in the viewer, this function would not render the annotation even
+     * if visibility is true.
+     *
+     * @param {string} annotationId the unique id of the annotation
+     * @param {integer}pageNumber the page number where annotation is located. It is 1-indexed
+     * @param {boolean }visibility whether the annotation should be visible
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.setVisibilityForAnnotation('Pdftron', 1, true);
+     */
+    setVisibilityForAnnotation = (id, pageNumber, visibility) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            DocumentViewManager.setVisibilityForAnnotation(tag, id, pageNumber, visibility);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Enables or disables highlighting form fields. It is disabled by default.
+     * @param {boolean} highlightFields whether form fields should be highlighted
+     * @example
+     * this._viewer.setHighlightFields(true);
+     */
+    setHighlightFields = (highlightFields) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            DocumentViewManager.setHighlightFields(tag, highlightFields);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Gets an annotation at the (x, y) position in screen coordinates, if any.
+     * @param {integer} x the x-coordinate of the point
+     * @param {integer} y the y-coordinate of the point
+     * @param {double} distanceThreshold maximum distance from the point (x, y)
+     * to the annotation for it to be considered a hit (in dp)
+     * @param {double} minimumLineWeight For very thin lines,
+     * it is almost impossible to hit the actual line.
+     * This specifies a minimum line thickness (in screen coordinates) for the purpose of calculating
+     * whether a point is inside the annotation or not (in dp)
+     * @returns {Promise<void | object>} annotation - the annotation found in the format of
+     * `{id: string, pageNumber: number, type: string,
+     * screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number},
+     * pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`.
+     *
+     * `type` is one of the {@link Config.Tools} constants.
+     *
+     * `screenRect` was formerly called `rect`.
+     * @example
+     * this._viewer.getAnnotationAtPoint(167, 287, 100, 10).then((annotation) => {
+     *   if (annotation) {
+     *     console.log('Annotation found at point (167, 287) has id:', annotation.id);
+     *   }
+     * })
+     */
+    getAnnotationAtPoint = (x, y, distanceThreshold, minimumLineWeight) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getAnnotationAt(tag, x, y, distanceThreshold, minimumLineWeight);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Gets the list of annotations at a given line in screen coordinates.
+     * Note that this is not an area selection. It should be used similar
+     * to {@link DocumentView#getAnnotationAtPoint getAnnotationAtPoint}, except that this should
+     * be used when you want to get multiple annotations which are overlaying with each other.
+     * @param {integer} x1 x-coordinate of an endpoint on the line
+     * @param {integer} y1 y-coordinate of an endpoint on the line
+     * @param {integer} x2 x-coordinate of the other endpoint on the line, usually used as a threshold
+     * @param {integer} y2 y-coordinate of the other endpoint on the line, usually used as a threshold
+     * @returns {Promise<void | object[]>} annotations - list of annotations at the target line,
+     * each in the format of `{id: string, pageNumber: number, type: string,
+     * screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number},
+     * pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`.
+     *
+     * `type` is one of the {@link Config.Tools} constants.
+     *
+     * `screenRect` was formerly called `rect`.
+     * @example
+     * this._viewer.getAnnotationListAt(0, 0, 200, 200).then((annotations) => {
+     *   for (const annotation of annotations) {
+     *     console.log('Annotation found at line has id:', annotation.id);
+     *   }
+     * })
+     */
+    getAnnotationListAt = (x1, y1, x2, y2) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getAnnotationListAt(tag, x1, y1, x2, y2);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Gets the list of annotations on a given page.
+     * @param {integer} pageNumber the page number where annotations are located. It is 1-indexed
+     * @returns {Promise<void | Array<object>>} annotations - list of annotations on the target page,
+     * each in the format of `{id: string, pageNumber: number, type: string,
+     * screenRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number},
+     * pageRect: {x1: number, y1: number, x2: number, y2: number, width: number, height: number}}`.
+     *
+     * `type` is one of the {@link Config.Tools} constants.
+     *
+     * `screenRect` was formerly called `rect`.
+     * @example
+     * this._viewer.getAnnotationsOnPage(2).then((annotations) => {
+     *   for (const annotation of annotations) {
+     *     console.log('Annotation found on page 2 has id:', annotation.id);
+     *   }
+     * })
+     */
+    getAnnotationsOnPage = (pageNumber) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getAnnotationListOnPage(tag, pageNumber);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Annotations
+     * @desc Gets an annotation's `customData` property.
+     * @param {string} annotationId the unique id of the annotation
+     * @param {integer} pageNumber the page number where annotation is located. It is 1-indexed
+     * @param {string} key the unique key associated with the `customData` property
+     * @returns {Promise<void | string>} value - the `customData` property associated
+     * with the given key
+     * @example
+     * this._viewer.setPropertiesForAnnotation("annotation1", 2, {
+     *   customData: {
+     *     data: "Nice annotation"
+     *   }
+     * }).then(() => {
+     *   this._viewer.getCustomDataForAnnotation("annotation1", 2, "data").then((value) => {
+     *     console.log(value === "Nice annotation");
+     *   })
+     * })
+     */
+    getCustomDataForAnnotation = (annotationID, pageNumber, key) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getCustomDataForAnnotation(tag, annotationID, pageNumber, key);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Gets the crop box for specified page as a JSON object.
+     * @param {integer} pageNumber the page number for the target crop box. It is 1-indexed
+     * @returns {Promise<void | object>} cropBox - an object with information about position
+     * (`x1`, `y1`, `x2` and `y2`) and size (`width` and `height`)
+     * @example
+     * this._viewer.getPageCropBox(1).then((cropBox) => {
+     *   console.log('bottom-left coordinate:', cropBox.x1, cropBox.y1);
+     *   console.log('top-right coordinate:', cropBox.x2, cropBox.y2);
+     *   console.log('width and height:', cropBox.width, cropBox.height);
+     * });
+     */
+    getPageCropBox = (pageNumber) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getPageCropBox(tag, pageNumber);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Sets current page of the document.
+     * @param {integer} pageNumber the page number to be set as the current page; 1-indexed
+     * @returns {Promise<void | boolean>} success - whether the setting process was successful
+     * @example
+     * this._viewer.setCurrentPage(4).then((success) => {
+     *   if (success) {
+     *     console.log("Current page is set to 4.");
+     *   }
+     * });
+     */
+    setCurrentPage = (pageNumber) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setCurrentPage(tag, pageNumber);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Gets the visible pages in the current viewer as an array.
+     * @returns {Promise<void | Array<number>>} visiblePages - a list of visible pages in the
+     * current viewer
+     * @example
+     * this._viewer.getVisiblePages().then((visiblePages) => {
+     *   for (const page of visiblePages) {
+     *     console.log('page', page, 'is visible.')
+     *   }
+     * });
+     */
+    getVisiblePages = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getVisiblePages(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Go to the previous page of the document. If on first page, it will stay on first page.
+     * @returns {Promise<void | boolean>} success - whether the setting process was successful
+     * (no change due to staying in first page counts as being successful)
+     * @example
+     * this._viewer.gotoPreviousPage().then((success) => {
+     *   if (success) {
+     *     console.log("Go to previous page.");
+     *   }
+     * });
+     */
+    gotoPreviousPage = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.gotoPreviousPage(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Go to the next page of the document. If on last page, it will stay on last page.
+     * @returns {Promise<void | boolean>} success - whether the setting process was successful
+     * (no change due to staying in last page counts as being successful)
+     * @example
+     * this._viewer.gotoNextPage().then((success) => {
+     *   if (success) {
+     *     console.log("Go to next page.");
+     *   }
+     * });
+     */
+    gotoNextPage = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.gotoNextPage(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Go to the first page of the document.
+     * @returns {Promise<void | boolean>} success - whether the setting process was successful
+     * @example
+     * this._viewer.gotoFirstPage().then((success) => {
+     *   if (success) {
+     *     console.log("Go to first page.");
+     *   }
+     * });
+     */
+    gotoFirstPage = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.gotoFirstPage(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Go to the last page of the document.
+     * @returns {Promise<void | boolean>} success - whether the setting process was successful
+     * @example
+     * this._viewer.gotoLastPage().then((success) => {
+     *   if (success) {
+     *     console.log("Go to last page.");
+     *   }
+     * });
+     */
+    gotoLastPage = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.gotoLastPage(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Opens a go-to page dialog. If the user inputs a valid page number into the dialog,
+     * the viewer will go to that page.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.showGoToPageView();
+     */
+    showGoToPageView = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.showGoToPageView(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Multi-tab
+     * @desc Closes all tabs in a multi-tab environment.
+     * @returns {Promise<void>}
+     * @example
+     * // Do this only when DocumentView has multiTabEnabled = true
+     * this._viewer.closeAllTabs();
+     */
+    closeAllTabs = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.closeAllTabs(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Multi-tab
+     * @desc Opens the tab switcher in a multi-tab environment.
+     * @returns {Promise<void>}
+     * @example
+     * // Do this only when DocumentView has multiTabEnabled = true
+     * this._viewer.openTabSwitcher();
+     */
+    openTabSwitcher = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.openTabSwitcher(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Zoom
+     * @desc Returns the current zoom scale of current document viewer.
+     * @returns {Promise<void | number>} zoom - current zoom scale in the viewer
+     * @example
+     * this._viewer.getZoom().then((zoom) => {
+     *   console.log('Zoom scale of the current document is:', zoom);
+     * });
+     */
+    getZoom = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getZoom(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Zoom
+     * @desc Sets the minimum and maximum zoom bounds of current viewer.
+     * @param {Config.ZoomLimitMode} zoomLimitMode defines whether bounds are relative to the
+     * standard zoom scale in the current viewer or absolute
+     * @param {double} minimum the lower bound of the zoom limit range
+     * @param {double} maximum the upper bound of the zoom limit range
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.setZoomLimits(Config.ZoomLimitMode.Absolute, 1.0, 3.5);
+     */
+    setZoomLimits = (zoomLimitMode, minimum, maximum) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setZoomLimits(tag, zoomLimitMode, minimum, maximum);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Zoom
+     * @desc Sets the zoom scale in the current document viewer with a zoom center.
+     * @param {double} zoom the zoom ratio to be set
+     * @param {int} x the x-coordinate of the zoom center
+     * @param {int} y the y-coordinate of the zoom center
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.zoomWithCenter(3.0, 100, 300);
+     */
+    zoomWithCenter = (zoom, x, y) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.zoomWithCenter(tag, zoom, x, y);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Zoom
+     * @desc Zoom the viewer to a specific rectangular area in a page.
+     * @param {int} pageNumber the page number of the zooming area (1-indexed)
+     * @param {object} rect The rectangular area with keys
+     * `x1` (left), `y1` (bottom), `y1` (right), `y2` (top). Coordinates are in double
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.zoomToRect(3, {'x1': 1.0, 'y1': 2.0, 'x2': 3.0, 'y2': 4.0});
+     */
+    zoomToRect = (pageNumber, rect) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.zoomToRect(tag, pageNumber, rect);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Zoom
+     * @desc Zoom to a paragraph that contains the specified coordinate.
+     * If no paragraph contains the coordinate, the zooming would not happen.
+     * @param {int} x the x-coordinate of the target coordinate
+     * @param {int} y the y-coordinate of the target coordinate
+     * @param {boolean} animated whether the transition is animated
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.smartZoom(100, 200, true);
+     */
+    smartZoom = (x, y, animated) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.smartZoom(tag, x, y, animated);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Scroll
+     * @desc Returns the horizontal and vertical scroll position of current document viewer.
+     * @returns {Promise<void | object>}
+     *
+     * Name | Type | Description
+     * --- | --- | ---
+     * horizontal | number | current horizontal scroll position
+     * vertical | number | current vertical scroll position
+     *
+     * @example
+     * this._viewer.getScrollPos().then(({horizontal, vertical}) => {
+     *   console.log('Current horizontal scroll position is:', horizontal);
+     *   console.log('Current vertical scroll position is:', vertical);
+     * });
+     */
+    getScrollPos = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getScrollPos(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Canvas
+     * @desc Returns the canvas size of current document viewer.
+     * @returns {Promise<void | object>}
+     *
+     * Name | Type | Description
+     * --- | --- | ---
+     * width | number | current width of canvas
+     * height | number | current height of canvas
+     *
+     * @example
+     * this._viewer.getCanvasSize().then(({width, height}) => {
+     *   console.log('Current canvas width is:', width);
+     *   console.log('Current canvas height is:', height);
+     * });
+     */
+    getCanvasSize = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getCanvasSize(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Gets the rotation value of all pages in the current document.
+     * @returns {Promise<void | number>} pageRotation - the rotation degree of all pages,
+     * one of 0, 90, 180 or 270 (clockwise).
+     * @example
+     * this._viewer.getPageRotation().then((pageRotation) => {
+     *   console.log('The current page rotation degree is' + pageRotation);
+     * });
+     */
+    getPageRotation = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getPageRotation(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Rotates all pages in the current document in clockwise direction (by 90 degrees).
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.rotateClockwise();
+     */
+    rotateClockwise = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.rotateClockwise(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Rotates all pages in the current document in counter-clockwise direction (by 90 degrees).
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.rotateCounterClockwise();
+     */
+    rotateCounterClockwise = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.rotateCounterClockwise(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Coordinate
+     * @desc Converts points from screen coordinates to page coordinates in the viewer.
+     * @param {object[]} points list of points, each in the format `{x: number, y: number}`.
+     * You could optionally have a `pageNumber: number` in the object.
+     * Without specifying, the page system is referring to the current page
+     * @returns {Promise<void | object[]>} convertedPoints - list of converted points in page system,
+     * each in the format `{x: number, y: number}`. It would be empty if conversion is unsuccessful
+     * @example
+     * // convert (50, 50) and (100, 100) from screen system to page system,
+     * // on current page and page 1 respectively
+     * this._viewer.convertScreenPointsToPagePoints([{x: 50, y: 50}, {x: 100, y:100, pageNumber: 1}])
+     *  .then((convertedPoints) => {
+     *    convertedPoints.forEach(point => {
+     *     console.log(point);
+     *    })
+     *  });
+     */
+    convertScreenPointsToPagePoints = (points) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.convertScreenPointsToPagePoints(tag, points);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Coordinate
+     * @desc Converts points from page coordinates to screen coordinates in the viewer.
+     * @param {object[]} points list of points, each in the format `{x: number, y: number}`.
+     * You could optionally have a `pageNumber: number` in the object.
+     * Without specifying, the page system is referring to the current page
+     * @returns {Promise<void | object[]>} convertedPoints - list of converted points in
+     * screen system, each in the format `{x: number, y: number}`.
+     * It would be empty if conversion is unsuccessful
+     * @example
+     * // convert (50, 50) on current page and (100, 100) on page 1 from page system to screen system
+     * this._viewer.convertPagePointsToScreenPoints([{x: 50, y: 50}, {x: 100, y:100, pageNumber: 1}])
+     *  .then((convertedPoints) => {
+     *    convertedPoints.forEach(point => {
+     *     console.log(point);
+     *    })
+     *  });
+     */
+    convertPagePointsToScreenPoints = (points) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.convertPagePointsToScreenPoints(tag, points);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Coordinate
+     * @desc Returns the page number that contains the point on screen.
+     * @param {number} x the x-coordinate of the screen point
+     * @param {number} y the y-coordinate of the screen point
+     * @returns {Promise<void | number>} pageNumber - the page number of the screen point
+     * @example
+     * this._viewer.getPageNumberFromScreenPoint(10.0,50.5).then((pageNumber) => {
+     *   console.log('The page number of the screen point is', pageNumber);
+     * });
+     */
+    getPageNumberFromScreenPoint = (x, y) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getPageNumberFromScreenPoint(tag, x, y);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Rendering Options
+     * @desc Sets whether the control will render progressively
+     * or will just draw once the entire view has been rendered.
+     * @param {boolean} progressiveRendering whether to render progressively
+     * @param {number} initialDelay delay before the progressive rendering timer is started,
+     * in milliseconds
+     * @param {number} interval delay between refreshes, in milliseconds
+     * @returns {Promise<void>}
+     * @example
+     * // delay for 10s before start, and refresh every 1s
+     * this._viewer.setProgressiveRendering(true, 10000, 1000);
+     */
+    setProgressiveRendering = (progressiveRendering, initialDelay, interval) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setProgressiveRendering(tag, progressiveRendering, initialDelay, interval);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Rendering Options
+     * @desc Enables or disables image smoothing.
+     * The rasterizer allows a trade-off between rendering quality and rendering speed.
+     * This function can be used to indicate the preference between rendering speed and quality.
+     * @param {boolean} imageSmoothing whether to enable image smoothing
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.setImageSmoothing(false);
+     */
+    setImageSmoothing = (imageSmoothing) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setImageSmoothing(tag, imageSmoothing);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Rendering Options
+     * @desc Enables or disables support for overprint and overprint simulation.
+     * Overprint is a device dependent feature and the results will vary depending
+     * on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc).
+     * @param {Config.OverprintMode} overprint the mode of overprint
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.setOverprint(Config.OverprintMode.Off);
+     */
+    setOverprint = (overprint) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setOverprint(tag, overprint);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category UI Customization
+     * @desc Sets the color post processing transformation mode for the viewer.
+     * @param {Config.ColorPostProcessMode} colorPostProcessMode color post processing
+     * transformation mode
+     * @example
+     * this._viewer.setColorPostProcessMode(Config.ColorPostProcessMode.NightMode);
+     */
+    setColorPostProcessMode = (colorPostProcessMode) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setColorPostProcessMode(tag, colorPostProcessMode);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category UI Customization
+     * @desc Sets the white and black color for the color post processing transformation.
+     * @param {object} whiteColor the white color for the color post processing transformation,
+     * in the format `{red: number, green: number, blue: number}`.
+     * `alpha` could be optionally included (only Android would apply alpha),
+     * and all numbers should be in range [0, 255]
+     * @param {object} blackColor the black color for the color post processing transformation,
+     * in the same format as whiteColor
+     * @example
+     * const whiteColor = {"red": 0, "green": 0, "blue": 255};
+     * const blackColor = {"red": 255, "green": 0, "blue": 0};
+     * this._viewer.setColorPostProcessColors(whiteColor, blackColor);
+     */
+    setColorPostProcessColors = (whiteColor, blackColor) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setColorPostProcessColors(tag, whiteColor, blackColor);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Search for a term and all matching results will be highlighted.
+     * @param {string} searchString the text to search for
+     * @param {boolean} matchCase indicates if it is case sensitive
+     * @param {boolean} matchWholeWord indicates if it matches an entire word only
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.startSearchMode('PDFTron', false, false);
+     */
+    startSearchMode = (searchString, matchCase, matchWholeWord) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.startSearchMode(tag, searchString, matchCase, matchWholeWord);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Finishes the current text search and remove all the highlights.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.exitSearchMode();
+     */
+    exitSearchMode = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.exitSearchMode(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Searches asynchronously, starting from the current page, for the given text.
+     * PDFViewCtrl automatically scrolls to the position so that the found text is visible.
+     * @param {string} searchString the text to search for
+     * @param {boolean} matchCase indicates if it is case sensitive
+     * @param {boolean} matchWholeWord indicates if it matches an entire word only
+     * @param {boolean} searchUp indicates if it searches upward
+     * @param {boolean} regExp indicates if searchString is a regular expression
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.findText('PDFTron', false, false, true, false);
+     */
+    findText = (searchString, matchCase, matchWholeWord, searchUp, regExp) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.findText(tag, searchString, matchCase, matchWholeWord, searchUp, regExp);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Cancels the current text search thread, if exists.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.cancelFindText();
+     */
+    cancelFindText = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.cancelFindText(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Displays a search bar that allows the user to enter and search text within a document.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.openSearch();
+     */
+    openSearch = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.openSearch(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Returns the text selection on a given page, if any.
+     * @param {number} pageNumber the specified page number. It is 1-indexed
+     * @returns {Promise<void | object>} selection - the text selection, in the format
+     * `{html: string, unicode: string, pageNumber: number,
+     * quads: [[{x: number, y: number}, {x: number, y: number},
+     * {x: number, y: number}, {x: number, y: number}], ...]}`.
+     * If no such selection could be found, this would be null
+     *
+     * Quads indicate the quad boundary boxes for the selection,
+     * which could have a size larger than 1 if selection spans across different lines.
+     * Each quad have 4 points with x, y coordinates specified in number, representing a boundary box.
+     * The 4 points are in counter-clockwise order, though the first point is not guaranteed to be on
+     * lower-left relatively to the box.
+     * @example
+     * this._viewer.getSelection(2).then((selection) => {
+     *   if (selection) {
+     *     console.log('Found selection on page', selection.pageNumber);
+     *     for (let i = 0; i < selection.quads.length; i ++) {
+     *       const quad = selection.quads[i];
+     *       console.log('selection boundary quad', i);
+     *       for (const quadPoint of quad) {
+     *         console.log('A quad point has coordinates', quadPoint.x, quadPoint.y);
+     *       }
+     *     }
+     *   }
+     * });
+     */
+    getSelection = (pageNumber) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getSelection(tag, pageNumber);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Returns whether there is a text selection in the current document.
+     * @returns {Promise<void | boolean>} hasSelection - whether a text selection exists
+     * @example
+     * this._viewer.hasSelection().then((hasSelection) => {
+     *   console.log('There is a selection in the document.');
+     * });
+     */
+    hasSelection = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.hasSelection(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Clears any text selection in the current document.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.clearSelection();
+     */
+    clearSelection = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.clearSelection(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Returns the page range (beginning and end) that has text selection on it.
+     * @returns {Promise<void | object>}
+     *
+     * Name | Type | Description
+     * --- | --- | ---
+     * begin | number | the first page to have selection, -1 if there are no selections
+     * end | number | the last page to have selection,  -1 if there are no selections
+     *
+     * @example
+     * this._viewer.getSelectionPageRange().then(({begin, end}) => {
+     *   if (begin === -1) {
+     *     console.log('There is no selection');
+     *   } else {
+     *     console.log('The selection range is from', begin, 'to', end);
+     *   }
+     * });
+     */
+    getSelectionPageRange = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getSelectionPageRange(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Returns whether there is a text selection on the specified page in the current document.
+     * @param {number} pageNumber the specified page number. It is 1-indexed
+     * @returns {Promise<void | boolean>} hasSelection - whether a text selection exists on
+     * the specified page
+     * @example
+     * this._viewer.hasSelectionOnPage(5).then((hasSelection) => {
+     *   if (hasSelection) {
+     *     console.log('There is a selection on page 5 in the document.');
+     *   }
+     * });
+     */
+    hasSelectionOnPage = (pageNumber) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.hasSelectionOnPage(tag, pageNumber);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Selects the text within the given rectangle region.
+     * @param {object} rect the rectangle region in the format of
+     * `{x1: number, x2: number, y1: number, y2: number}`
+     * @returns {Promise<void | boolean>} selected - whether there is text selected
+     * @example
+     * this._viewer.selectInRect({x1: 0, y1: 0, x2: 200.5, y2: 200.5}).then((selected) => {
+     *         console.log(selected);
+     * });
+     */
+    selectInRect = (rect) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.selectInRect(tag, rect);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Returns whether there is text in given rectangle region.
+     * @param {object} rect the rectangle region in the format of
+     * `{x1: number, x2: number, y1: number, y2: number}`
+     * @returns {Promise<void | boolean>} hasText - whether there is text in the region
+     * @example
+     * this._viewer.isThereTextInRect({x1: 0, y1: 0, x2: 200, y2: 200}).then((hasText) => {
+     *         console.log(hasText);
+     * });
+     */
+    isThereTextInRect = (rect) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.isThereTextInRect(tag, rect);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Text Selection
+     * @desc Selects all text on the page.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.selectAll();
+     */
+    selectAll = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.selectAll(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Viewer Options
+     * @desc Sets whether borders of each page are visible in the viewer,
+     * which is disabled by default.
+     * @param {boolean} pageBorderVisibility whether borders of each page are visible in the viewer
+     * @example
+     * this._viewer.setPageBorderVisibility(true);
+     */
+    setPageBorderVisibility = (pageBorderVisibility) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setPageBorderVisibility(tag, pageBorderVisibility);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Viewer Options
+     * @desc Enables or disables transparency grid (check board pattern) to reflect page transparency,
+     * which is disabled by default.
+     * @param {boolean} pageTransparencyGrid whether to use the transparency grid
+     * @example
+     * this._viewer.setPageTransparencyGrid(true);
+     */
+    setPageTransparencyGrid = (pageTransparencyGrid) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setPageTransparencyGrid(tag, pageTransparencyGrid);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Viewer Options
+     * @desc Sets the default page color of the viewer.
+     * @param {object} defaultPageColor the default page color, in the format
+     * `{red: number, green: number, blue: number}`, each number in range [0, 255]
+     * @example
+     * this._viewer.setDefaultPageColor({red: 0, green: 255, blue: 0}); // green color
+     */
+    setDefaultPageColor = (defaultPageColor) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setDefaultPageColor(tag, defaultPageColor);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Viewer Options
+     * @desc Sets the background color of the viewer.
+     * @param {object} backgroundColor the background color, in the format
+     * `{red: number, green: number, blue: number}`, each number in range [0, 255]
+     * @example
+     * this._viewer.setBackgroundColor({red: 0, green: 0, blue: 255}); // blue color
+     */
+    setBackgroundColor = (backgroundColor) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setBackgroundColor(tag, backgroundColor);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @desc Export a PDF page to image format defined in {@link Config.ExportFormat}.
+     *
+     * Unlike {@link RNPdftron#exportAsImage RNPdftron.exportAsImage},
+     * this is a viewer method and should only be called *after* the document has been
+     * loaded or else unexpected behaviour can occur.
+     * This method uses the PDF that is associated with the viewer,
+     * and does not take a local file path to the desired PDF.
+     * @param {int} pageNumber the page to be converted;
+     * if the value does not refer to a valid page number, the file path will be undefined
+     * @param {double} dpi the output image resolution
+     * @param {Config.ExportFormat} exportFormat image format to be exported to
+     * @returns {Promise<void | string>} path - the temp path of the created image,
+     * user is responsible for clean up the cache
+     * @example
+     * this._viewer.exportToImage(1, 92, Config.ExportFormat.BMP).then((path) => {
+     *   console.log('export', path);
+     * });
+     */
+    exportAsImage = (pageNumber, dpi, exportFormat) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.exportAsImage(tag, pageNumber, dpi, exportFormat);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Undo/Redo
+     * @desc Undo the last modification.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.undo();
+     */
+    undo = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.undo(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Undo/Redo
+     * @desc Redo the last modification.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.redo();
+     */
+    redo = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.redo(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Undo/Redo
+     * @desc Checks whether an undo operation can be performed from the current snapshot.
+     * @returns {Promise<void | boolean>} canUndo - whether it is possible to undo from
+     * the current snapshot
+     * @example
+     * this._viewer.canUndo().then((canUndo) => {
+     *   console.log(canUndo ? 'undo possible' : 'no action to undo');
+     * });
+     */
+    canUndo = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.canUndo(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Undo/Redo
+     * @desc Checks whether a redo operation can be perfromed from the current snapshot.
+     * @returns {Promise<void | boolean>} canRedo - whether it is possible to redo from
+     * the current snapshot
+     * @example
+     * this._viewer.canRedo().then((canRedo) => {
+     *   console.log(canRedo ? 'redo possible' : 'no action to redo');
+     * });
+     */
+    canRedo = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.canRedo(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @desc Displays the page crop option. Android only.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.showCrop();
+     */
+    showCrop = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.showCrop(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Toolbar
+     * @desc Sets the current {@link DocumentView.annotationToolbars annotationToolbars}
+     * for the viewer.
+     * @param {Config.DefaultToolbars|string} toolbar the toolbar to enable. Should be one of the
+     * {@link Config.DefaultToolbars} constants or the `id` of a custom toolbar object.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.setCurrentToolbar(Config.DefaultToolbars.Insert).then(() => {
+     *   // done switching toolbar
+     * });
+     */
+    setCurrentToolbar = (toolbar) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.setCurrentToolbar(tag, toolbar);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @desc Displays the view settings.
+     *
+     * Requires a source rect in screen co-ordinates.
+     * On iOS this rect will be the anchor point for the view. The rect is ignored on Android.
+     * @param {map} rect The rectangular area in screen co-ordinates with keys
+     * `x1` (left), `y1` (bottom), `y1` (right), `y2` (top). Coordinates are in double format.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.showViewSettings({'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0});
+     */
+    showViewSettings = (rect) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.showViewSettings(tag, rect);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Page
+     * @desc Android only.
+     *
+     * Displays a rotate dialog.
+     * This dialog allows users to rotate pages of the opened document by 90, 180 and 270 degrees.
+     * It also displays a thumbnail of the current page at the selected rotation angle.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.showRotateDialog();
+     */
+    showRotateDialog = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.showRotateDialog(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @desc Displays the add pages view.
+     *
+     * Requires a source rect in screen co-ordinates.
+     * On iOS this rect will be the anchor point for the view. The rect is ignored on Android.
+     * @param {map} rect The rectangular area in screen co-ordinates with keys
+     * `x1` (left), `y1` (bottom), `y1` (right), `y2`(top). Coordinates are in double format.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.showAddPagesView({'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0});
+     */
+    showAddPagesView = (rect) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.showAddPagesView(tag, rect);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Reflow
+     * @desc Returns whether the viewer is currently in reflow mode.
+     * @returns {Promise<void | boolean>} inReflow - whether the viewer is in reflow mode
+     * @example
+     * this._viewer.isReflowMode().then((inReflow) => {
+     *   console.log(inReflow ? 'in reflow mode' : 'not in reflow mode');
+     * });
+     */
+    isReflowMode = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.isReflowMode(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Reflow
+     * @desc Allows the user to programmatically enter and exit reflow mode.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.toggleReflow();
+     */
+    toggleReflow = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.toggleReflow(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @desc Displays the share copy view.
+     *
+     * Requires a source rect in screen co-ordinates.
+     * On iOS this rect will be the anchor point for the view. The rect is ignored on Android.
+     * @returns {Promise<void>}
+     * @param {map} rect The rectangular area in screen co-ordinates with keys
+     * `x1` (left), y1 (bottom), `y1` (right), `y2` (top). Coordinates are in double format.
+     * @param {boolean} flattening Whether the shared copy should be flattened before sharing.
+     * @example
+     * this._viewer.shareCopy({'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0}, true);
+     */
+    shareCopy = (rect, flattening) => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.shareCopy(tag, rect, flattening);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Thumbnails
+     * @desc Display a page thumbnails view.
+     *
+     * This view allows users to navigate pages of a document.
+     * If {@link DocumentView.thumbnailViewEditingEnabled thumbnailViewEditingEnabled} is true,
+     * the user can also manipulate the document, including add, remove, re-arrange, rotate and
+     * duplicate pages.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.openThumbnailsView();
+     */
+    openThumbnailsView = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.openThumbnailsView(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @desc Displays the outline tab of the existing list container.
+     * If this tab has been disabled, the method does nothing.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.openOutlineList();
+     */
+    openOutlineList = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.openOutlineList(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @desc 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 {Promise<void>}
+     * @example
+     * this._viewer.openLayersList();
+     */
+    openLayersList = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.openLayersList(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @desc Displays the existing list container. Its current tab will be the one last opened.
+     * @returns {Promise<void>}
+     * @example
+     * this._viewer.openNavigationLists();
+     */
+    openNavigationLists = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.openNavigationLists(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Signature
+     * @desc Gets a list of absolute file paths to PDFs containing the saved signatures.
+     * @returns {Promise<void | Array<string>>} signatures - an array of string containing the
+     * absolute file paths; if there are no saved signatures, the value is an empty array
+     * @example
+     * this._viewer.getSavedSignatures().then((signatures) => {
+     *   if (signatures.length > 0) {
+     *     signatures.forEach((signature) => {
+     *       console.log(signature);
+     *     });
+     *   }
+     * })
+     */
+    getSavedSignatures = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getSavedSignatures(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Signature
+     * @desc Retrieves the absolute file path to the folder containing the saved signatures.
+     * For Android, to get the folder containing the saved signature JPGs, use
+     * {@link DocumentView.getSavedSignatureJpgFolder getSavedSignatureJpgFolder}.
+     * @returns {Promise<void | string>} path - the absolute file path to the folder
+     * @example
+     * this._viewer.getSavedSignatureFolder().then((path) => {
+     *   if (path != null) {
+     *     console.log(path);
+     *   }
+     * })
+     */
+    getSavedSignatureFolder = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getSavedSignatureFolder(tag);
+        }
+        return Promise.resolve();
+    };
+    /**
+     * @method
+     * @category Signature
+     * @desc Android only.
+     *
+     * Retrieves the absolute file path to the folder containing the saved signature JPGs.
+     * For Android, to get the folder containing the saved signature PDFs, use
+     * {@link DocumentView.getSavedSignatureFolder getSavedSignatureFolder}.
+     * @returns {Promise<void | string>} path - the absolute file path to the folder
+     * @example
+     * this._viewer.getSavedSignatureJpgFolder().then((path) => {
+     *   if (path != null) {
+     *     console.log(path);
+     *   }
+     * })
+     */
+    getSavedSignatureJpgFolder = () => {
+        const tag = findNodeHandle(this._viewerRef);
+        if (tag != null) {
+            return DocumentViewManager.getSavedSignatureJpgFolder(tag);
+        }
+        return Promise.resolve();
+    };
+    /** @ignore */
+    _setNativeRef = (ref) => {
+        this._viewerRef = ref;
+    };
+    /**
+     * @ignore
+     *
+     */
+    render() {
+        return (
+        // @ts-ignore
+        <RCTDocumentView ref={this._setNativeRef} 
+        // @ts-ignore
+        style={{ flex: 1 }} 
+        // @ts-ignore: Intentionally exclude `onChange` from being exposed as a prop.
+        onChange={this.onChange} {...this.props}/>);
+    }
+}
+const name = Platform.OS === 'ios' ? 'RNTPTDocumentView' : 'RCTDocumentView';
+const RCTDocumentView = requireNativeComponent(name);
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/lib_src_PDFViewCtrl_PDFViewCtrl.js.html b/docs/lib_src_PDFViewCtrl_PDFViewCtrl.js.html new file mode 100644 index 000000000..21c5758ee --- /dev/null +++ b/docs/lib_src_PDFViewCtrl_PDFViewCtrl.js.html @@ -0,0 +1,270 @@ + + + + + + + PDFTron React Native Source: lib/src/PDFViewCtrl/PDFViewCtrl.js + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: lib/src/PDFViewCtrl/PDFViewCtrl.js

+ +
+
+
import React, { PureComponent } from 'react';
+import PropTypes from 'prop-types';
+import { requireNativeComponent, ViewPropTypes, Platform } from 'react-native';
+/**
+ * @desc This object outlines valid {@link PDFViewCtrl} class props.
+ * These can be passed into {@link PDFViewCtrl} to customize the viewer.
+ * @ignore
+ */
+const PDFViewCtrlPropTypes = {
+    /**
+     * @memberof PDFViewCtrl
+     * @type {string}
+     * @desc The path or url to the document. Required.
+     * @hidesource
+     * @example
+     * <PDFViewCtrl
+     *   document={'https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_about.pdf'}
+     * />
+     */
+    document: PropTypes.string.isRequired
+};
+/**
+  * @class
+  * @classdesc A React component for displaying documents of different types such as
+  * PDF, docx, pptx, xlsx and various image formats.
+  *
+  * PDFViewCtrl is useful when a higher level of customization is required.
+  * For easy all-in-one document viewing and editing, use {@link DocumentView}.
+  * @hideconstructor
+  * @hidesource
+  * @ignore
+  */
+export class PDFViewCtrl extends PureComponent {
+    static propTypes = Object.assign(PDFViewCtrlPropTypes, { ...ViewPropTypes });
+    render() {
+        return (<RCTPDFViewCtrl 
+        // @ts-ignore
+        style={{ flex: 1 }} {...this.props}/>);
+    }
+}
+const name = Platform.OS === 'ios' ? 'RNTPTPDFViewCtrl' : 'RCTPDFViewCtrl';
+const RCTPDFViewCtrl = requireNativeComponent(name);
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/quicksearch.html b/docs/quicksearch.html new file mode 100644 index 000000000..4b1506ded --- /dev/null +++ b/docs/quicksearch.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + diff --git a/docs/scripts/docstrap.lib.js b/docs/scripts/docstrap.lib.js new file mode 100644 index 000000000..09d9272a0 --- /dev/null +++ b/docs/scripts/docstrap.lib.js @@ -0,0 +1,11 @@ +if(!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b="length"in a&&a.length,c=_.type(a);return"function"!==c&&!_.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a))}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+h.uid++}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c||"false"!==c&&("null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c)}catch(a){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("