PDF viewer events
PSPDFKit for React Native allows you to listen to various events that occur when the end user interacts with PSPDFKit.
The following table lists the events supported by PSPDFKit for React Native.
Event | Description |
---|---|
onCloseButtonPressed |
Called when the close button is pressed |
onStateChanged |
Called when the PSPDFKitView ’s state changed |
onDocumentSaved |
Called when the document has been successfully saved |
onDocumentSaveFailed |
Called when the document failed to save |
onDocumentLoadFailed |
Called when the document failed to load |
onAnnotationTapped |
Called when the end user tapped on an annotation |
onAnnotationsChanged |
Called when one or more annotations have changed |
onNavigationButtonClicked |
Called when the navigation back button is pressed |
onDataReturned |
Called when the PSPDFKitView returns data |
You can also see the list of events in
index.js
. All events have the “on” prefix.
Implementing an event listener
The example below shows how to implement an event listener to get notified when a document is saved:
<PSPDFKitView document={DOCUMENT} onDocumentSaved={(event) => { if (event['error']) { alert(event['error']); } else { alert('Document Saved!'); } }} ref="pdfView" fragmentTag="PDF1" style={{ flex: 1 }} />
For more details and sample code, see the EventListeners.tsx
example from the Catalog example project.