---
title: "Define annotation behavior in a PDF with flags on React Native | Nutrient"
canonical_url: "https://www.nutrient.io/guides/react-native/annotations/create-edit-and-remove/annotation-flags/"
md_url: "https://www.nutrient.io/guides/react-native/annotations/create-edit-and-remove/annotation-flags.md"
last_updated: "2026-05-15T19:10:05.052Z"
description: "Discover how to use Nutrient’s annotation flags to control behavior, visibility, and print settings for PDF annotations effectively."
---

# Define annotation behavior with flags on React Native

Every `Annotation` in a document can specify flags that further define its behavior and capabilities. With Nutrient, you can set these flags directly on your annotation objects using the `setAnnotationFlags` method found on the [`NutrientView`](https://www.nutrient.io/api/react-native/NutrientView.html) 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:

- An annotation with an [`Annotation.Flags.INVISIBLE`](https://www.nutrient.io/api/react-native/Annotation.html#.Flags) flag will ignore annotation appearance streams.

- An annotation with a flag set to [`Annotation.Flags.HIDDEN`](https://www.nutrient.io/api/react-native/Annotation.html#.Flags) won’t be displayed or printed.

- An annotation with an [`Annotation.Flags.PRINT`](https://www.nutrient.io/api/react-native/Annotation.html#.Flags) flag will be printed. [`Annotation.Flags.PRINT`](https://www.nutrient.io/api/react-native/Annotation.html#.Flags) is the default flag.

- An annotation with a flag set to [`Annotation.Flag.NO_VIEW`](https://www.nutrient.io/api/react-native/Annotation.html#.Flags) won’t be displayed onscreen, but printing might be allowed.

- Annotations with an [`Annotation.Flags.READ_ONLY`](https://www.nutrient.io/api/react-native/Annotation.html#.Flags) flag don’t allow user interactions. The flag is ignored for widget annotations.

- If you want to prevent your users from editing an annotation, you can set the [`Annotation.Flags.LOCKED`](https://www.nutrient.io/api/react-native/Annotation.html#.Flags) and [`Annotation.Flags.LOCKED_CONTENTS`](https://www.nutrient.io/api/react-native/Annotation.html#.Flags) 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:

```typescript

// 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?.getDocument().setAnnotationFlags("596db901-f05c-4637-890d-da03a33eb0ef", [
    Annotation.Flags.READ_ONLY,
  ]);

```

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

```typescript

// Get the existing annotation flags.
const result = await this.pdfRef.current?.getDocument().getAnnotationFlags("596db901-f05c-4637-890d-da03a33eb0ef");

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

```

Refer to the [`ProgrammaticAnnotations.tsx` example](https://github.com/PSPDFKit/react-native/blob/master/samples/Catalog/examples/ProgrammaticAnnotations.tsx) in the [Catalog example project](https://www.nutrient.io/guides/react-native/prebuilt-solutions/example-projects.md#pspdfkit-catalog) for a runnable example.
---

## Related pages

- [Programmatically create annotations in React Native](/guides/react-native/annotations/create-edit-and-remove/programmatic.md)
- [Disable annotation editing in React Native](/guides/react-native/annotations/create-edit-and-remove/disable-editing.md)
- [Set annotation author in React Native](/guides/react-native/annotations/create-edit-and-remove/author-name.md)
- [Programmatically select or deselect annotations in React Native](/guides/react-native/annotations/create-edit-and-remove/selection-deselection.md)
- [Detecting if annotations have changed in React Native](/guides/react-native/annotations/create-edit-and-remove/detect-changes.md)

