| FoxitPDFSDKforWeb v11.0.6 Archives Foxit PDF SDK for Web

Public Member Functions | Protected Member Functions | List of all members
XViewerUI Class Reference
UIExtension

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

new PDFUI({
viewerOptions: {
viewerUI: new class extends UIExtension.XViewerUI {
createContextMenu(owner, anchor, config) {
// ...
}
}
}
})

. More...

Inheritance diagram for XViewerUI:

## Public Member Functions
| alert (message, title)
| A method shows alert dialog like `window.alert()` More...
| confirm (message, title)
| A method shows confirm dialog like `window.alert()` More...
| createContextMenu (owner, anchor, config)
| A method which is used to create the contextmenu component and registers the right-click event. You can override this method to customize the right-click menu. More...
| prompt (defaultValue, message, title)
| A method shows prompt dialog like `window.alert()` More...
Public Member Functions inherited from IViewerUI
| 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...

## Protected Member Functions
| getAnnotsContextMenuName (owner)
| Obtains the contextmenu component name according to the owner annotation's type. If the component's name is not found in the template, you need to use the default contextmenu component according to the type of Annotation. 'fv–markup-contextmenu'， 'fv–textmarkup-contextmenu' and 'fv–default-annot-contextmenu' are used as default contextmenu component name by the implementation of the `XViewerUI.createContextMenu` method. More...
| getContextMenuNameByOwner (owner)
| Obtains the contextmenu component name according to the owner type(including state-handler name or `AnnotComponent` instance). More...

## Detailed Description

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

new PDFUI({
viewerOptions: {
viewerUI: new class extends UIExtension.XViewerUI {
createContextMenu(owner, anchor, config) {
// ...
}
}
}
})

.

Since
  7.2.0

## Member Function Documentation

## ◆ alert()

XViewerUI::alert | ( |  | message,
|  |  | title
| ) |  |
| inline

A method shows alert dialog like `window.alert()`

Parameters

  message | string - The alert message.
  [title] | string - The title of alert dialog.

Returns
  Promise<void> - A fulfilled Promise.

## ◆ confirm()

XViewerUI::confirm | ( |  | message,
|  |  | title
| ) |  |
| inline

A method shows confirm dialog like `window.alert()`

Parameters

  message | string - The confirm message.
  [title] | string - The title of the confirm dialog.

Returns
  Promise<void> - A fulfilled Promise if user confirmed, otherwise rejected Promise.

## ◆ createContextMenu()

XViewerUI::createContextMenu | ( |  | owner,
|  |  | anchor,
|  |  | config
| ) |  |
| inline

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

Parameters

  owner | string|AnnotComponent - 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, this element may be the anchor or it's children, this selector is used to detect the right-click event target.

Returns
  IContextMenu

## ◆ getAnnotsContextMenuName()

XViewerUI::getAnnotsContextMenuName | ( |  | owner | ) |
| inline protected

Obtains the contextmenu component name according to the owner annotation's type. If the component's name is not found in the template, you need to use the default contextmenu component according to the type of Annotation. 'fv–markup-contextmenu'， 'fv–textmarkup-contextmenu' and 'fv–default-annot-contextmenu' are used as default contextmenu component name by the implementation of the `XViewerUI.createContextMenu` method.

Parameters

  owner | AnnotComponent

Returns
  string

## ◆ getContextMenuNameByOwner()

XViewerUI::getContextMenuNameByOwner | ( |  | owner | ) |
| inline protected

Obtains the contextmenu component name according to the owner type(including state-handler name or `AnnotComponent` instance).

Parameters

  owner | string|AnnotComponent - 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`.

Returns
  string|undefined - undefined if owner is unsupported otherwise an string.

## ◆ prompt()

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

A method shows prompt dialog like `window.alert()`

Parameters

  defaultValue | string - The default value of the input box.
  message | string - The message above the input.
  [title] | string - The title of the prompt dialog.

Returns
  Promise<string> - A fulfilled Promise with the value of the input box if user confirmed, otherwise rejected Promise.

@2025 Foxit Software Incorporated. All rights reserved.