Define Annotation Behavior with Flags on React Native

Every Annotation in a document can specify flags that further define its behavior and capabilities. With PSPDFKit, you can set these flags directly on your annotation objects using the setAnnotationFlags method found on the PSPDFKitView component.

Capabilities of Flags

Annotation flags are part of the PDF specification and define an annotation’s behavior, its presentation onscreen and on paper, and the available editing features given to your users. Here are a few examples of things you can do with flags:


Refer to the Annotation.Flags API reference for a complete list of available flags.

Usage Example

Here’s an example of how to create a locked annotation, i.e. an annotation that can’t be modified by your users:

// Add a new annotation to your document.
const result = await this.pdfRef.current?.addAnnotation(annotationJSON);

// Grab the annotation GUID by registering for the `onAnnotationsChanged()` event.

// Set the desired annotation flags.
await this.pdfRef.current?.setAnnotationFlags(

The current annotation flags can also be queried to append new flags before setting flags on the annotation again:

// Get the existing annotation flags.
const result = await this.pdfRef.current?.getAnnotationFlags(

Alert.alert('PSPDFKit', `Annotation flags: ${JSON.stringify(flags)}`);

Refer to the ProgrammaticAnnotations.tsx example in the Catalog example project for a runnable example.