Auto save annotations in React Native

PSPDFKit will automatically save changed, created, or deleted annotations to a document on several occasions. In practice, this means that automatic saving will be performed when:

  • The application goes into the background
  • A configuration change occurs (for example, change of device orientation, change of locale, added keyboard)
  • The PSPDFKitView is fully covered by another View
  • The document on the PSPDFKitView is changed
  • A document will be digitally signed

Each time the document is saved, the onDocumentSaved() event is called:

onDocumentSaved={(event) => {
alert("Document was saved!");
}}

If there were no new changes to save, the event won’t be called.

Disable automatic saving

To disable automatic saving, set the disableAutomaticSaving prop to true, like so:

<PSPDFKitView
document={DOCUMENT}
disableAutomaticSaving={true}
ref="pdfView"
fragmentTag="PDF1"
/>