NotificationCenter

Members

(static, readonly) AnalyticsEvent :string

Analytics events.
Type:
  • string
Properties:
Name Type Description
ANALYTICS string Called when any analytics event has been triggered.
Source:

(static, readonly) AnnotationsEvent :string

Annotation events.
Type:
  • string
Properties:
Name Type Description
ADDED string Called when one or more annotations have been added.
CHANGED string Called when an existing annotation has been changed.
REMOVED string Called when one or more annotations have been removed.
SELECTED string Called when one or more annotations have been selected.
DESELECTED string Called when one or more annotations have been deselected.
TAPPED string Called when a user taps on an annotation.
Source:

(static, readonly) BookmarksEvent :string

Bookmarks events.
Type:
  • string
Properties:
Name Type Description
CHANGED string Called when the bookmarks have been changed.
Source:

(static, readonly) DocumentEvent :string

Document events.
Type:
  • string
Properties:
Name Type Description
LOADED string Called when the document has been loaded.
LOAD_FAILED string Called when the document failed to load.
PAGE_CHANGED string Called when the document page changed.
SCROLLED string Called when the document is scrolled.
VIEWPORT_CHANGED string Called when the document viewport (zoom or scroll) changes. The payload carries the current transformation state so custom overlays can be positioned in sync with the rendered document.
TAPPED string Called when the document is tapped.
Source:

(static, readonly) DocumentLoadFailedCode :string

Document load failure error codes.
Type:
  • string
Properties:
Name Type Description
CORRUPT string Document is corrupted or invalid.
ENCRYPTED string Document is encrypted and requires a password.
Source:

(static, readonly) FormFieldEvent :string

FormField events.
Type:
  • string
Properties:
Name Type Description
VALUES_UPDATED string Called when form field values have changed.
SELECTED string Called when a form field has been selected.
DESELECTED string Called when a form field has been deselected.
Source:

(static, readonly) TextEvent :string

Text Selection events.
Type:
  • string
Properties:
Name Type Description
SELECTED string Called when a text selection has been made.
Source:

Methods

(static) subscribe(event, callback) → {NotificationCenter.Subscription}

Subscribes to a given Notification Center event.
Parameters:
Name Type Description
event string The event to subscribe to. Use NotificationCenter.DocumentEvent, NotificationCenter.AnnotationsEvent, etc. for type-safe events.
callback function The callback to be called when the event is triggered. The payload type is automatically inferred based on the event type.
Source:
Returns:
A handle that removes this listener when its ``remove`` method is called. Multiple listeners can be subscribed to the same event; each handle removes only its own listener.
Type
NotificationCenter.Subscription
Example
const subscription = this.pdfRef.current?.notificationCenter().subscribe(NotificationCenter.DocumentEvent.LOADED, (payload: NotificationCenter.DocumentLoadedPayload) => {
  console.log('Document ID: ' + payload.documentID); // payload is typed as DocumentLoadedPayload
});
// Later:
subscription.remove();

(static) unsubscribe(event)

Unsubscribes all listeners from a given Notification Center event. To remove a single listener, call ``remove`` on the subscription returned by ``subscribe`` instead.
Parameters:
Name Type Description
event string The event to unsubscribe from.
Source:
Example
this.pdfRef.current?.notificationCenter().unsubscribe('documentLoaded');

(static) unsubscribeAllEvents()

Unsubscribes from all Notification Center events.
Source:
Example
this.pdfRef.current?.notificationCenter().unsubscribeAllEvents();