| FoxitPDFSDKforWeb v11.0.6 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
IViewerUI Class Reference
PDFViewCtrl » viewerui

This class provides an ability for user to customize the several UI like contextmenu which may be triggered from `PDFViewCtrl` module, that stuffs should be customized like the example:

new PDFViewer({
...otherOptions,
viewerUI: class extends PDFViewCtrl.IViewerUI {
...implementations
}
})

. More...

Inheritance diagram for IViewerUI:

## Public Member Functions
| alert (message)
| Display an alert dialog with the optional content and an OK button, then returns an fullfilled Promise after alert dialog closed. More...
| confirm (message)
| Displays a modal dialog with an optional message and two buttons: OK and Cancel, then returns an Promise, that will be fullfilled if user clicks OK, and be rejected if user clicks Cancel. More...
| createContextMenu (key, anchor, config)
| A method used to create the contextmenu component and registers the right-click event. You can override this method to customize the right-click menus. More...
| createDateTimePicker (format)
| Create an IDateTimePicker component based on the specified format. More...
| createTextSelectionTooltip (pageRender)
| Creates a tooltip component that displays when user select texts. More...
| destroy ()
| A method will be called when PDFViewer is destroyed. You should override this method to perform the operation of destroy resources.
| getSignatureUI ()
| Obtains the instance which implements ISignatureUI. This method retrieves the user interface component responsible for managing digital signatures. More...
| loading (coverOn)
| Displays a loading layer to indicate the loading state of a page or a component. More...
| prompt (defaultValue, message, title)
| Displays a dialog with an optional message prompting the user to input some text. More...
| promptPassword (defaultValue, message, title)
| Displays a dialog with a optional message prompting the user to input password. More...

## Detailed Description

This class provides an ability for user to customize the several UI like contextmenu which may be triggered from `PDFViewCtrl` module, that stuffs should be customized like the example:

new PDFViewer({
...otherOptions,
viewerUI: class extends PDFViewCtrl.IViewerUI {
...implementations
}
})

.

## Member Function Documentation

## ◆ alert()

IViewerUI::alert | ( |  | message | ) |
| inline

Display an alert dialog with the optional content and an OK button, then returns an fullfilled Promise after alert dialog closed.

Parameters

  message | string - The alert dialog message, i18nect.js entry format.

Returns
  Promise<void>

## ◆ confirm()

IViewerUI::confirm | ( |  | message | ) |
| inline

Displays a modal dialog with an optional message and two buttons: OK and Cancel, then returns an Promise, that will be fullfilled if user clicks OK, and be rejected if user clicks Cancel.

Parameters

  message | string - The confirm dialog message, i18next.js entry format.

Returns
  Promise<void>

## ◆ createContextMenu()

IViewerUI::createContextMenu | ( |  | key,
|  |  | anchor,
|  |  | config
| ) |  |
| inline

A method used to create the contextmenu component and registers the right-click event. You can override this method to customize the right-click menus.

Parameters

  key | any - Indicates the owner of the contextmneu instance returned by this method , which can be the name of a state-handler or an instance of `AnnotComponent`.
  anchor | HTMLElement - An html element used to respond to right-click events.
  config | object
  config.selector | string - A css selector of an element where to trigger this menu, this element should be the anchor or it's children.
  config.items | Array<{nameI18nKey:string}> - The default menu items, Refer to JQuery contextmenu plugin
  config.items[].nameI18nKey | string - Menu text in i18next.js entry format.

Returns
  IContextMenu|undefined - An context menu component including show/hide and destroy API and returning undefined means that the right-click menu of the specified target will not be displayed

## ◆ createDateTimePicker()

IViewerUI::createDateTimePicker | ( |  | format | ) |
| inline

Create an IDateTimePicker component based on the specified format.

Parameters

  format | string - The date time format, such as 'HH:MM', 'h:MM tt', 'HH:MM:ss', 'h:MM:ss tt', 'm/d/yyyy'

Returns
  IDateTimePicker - The instance of the DateTimePicker, which will be automatically managed and destroyed by its owner.

Since
  10.0.0

Note
  This method creates an IDateTimePicker component with the specified format. The IDateTimePicker instance returned by this method will be automatically managed and destroyed by its owner object, eliminating the need for manual management by the application layer.
  Additionally, the items displayed on the IDateTimePicker component will be determined by the specified format. For example, if the format is 'HH:MM', only hours and minutes will be displayed for user editing.

## ◆ createTextSelectionTooltip()

IViewerUI::createTextSelectionTooltip | ( |  | pageRender | ) |
| inline

Creates a tooltip component that displays when user select texts.

Parameters

  pageRender | PDFPageRender

Returns
  IFloatingTooltip

## ◆ getSignatureUI()

IViewerUI::getSignatureUI | ( |  | ) |
| inline

Obtains the instance which implements ISignatureUI. This method retrieves the user interface component responsible for managing digital signatures.

Returns
  Promise<ISignatureUI> - A promise that resolves to the instance of ISignatureUI.

Since
  11.0.0

## ◆ loading()

IViewerUI::loading | ( |  | coverOn | ) |
| inline

Displays a loading layer to indicate the loading state of a page or a component.

Parameters

  coverOn | HTMLElement - the target layer

Returns
  Function - A function used to close the loading layer.

## ◆ prompt()

IViewerUI::prompt | ( |  | defaultValue,
|  |  | message,
|  |  | title
| ) |  |
| inline

Displays a dialog with an optional message prompting the user to input some text.

Parameters

  defaultValue | string - A string contains the default value displayed in the text input.
  message | string - A string of text to display to user.
  title | string - A string of the dialog title.

Returns
  Promise<string> - Returns a promise that fullfilled with the value in the input.

## ◆ promptPassword()

Promise< string > IViewerUI::promptPassword | ( |  | defaultValue,
|  |  | message,
|  |  | title
| ) |  |
| inline

Displays a dialog with a optional message prompting the user to input password.

Parameters

  defaultValue | string - A string value of password displayed in the password input
  message | string - A string of text to display to user.
  title | string - A string of the dialog title

Returns
  Promise<string> - Returns a promise that fullfilled with the value in the password input.

@2025 Foxit Software Incorporated. All rights reserved.