---
title: "Define annotation behavior in a PDF with flags on iOS | Nutrient"
canonical_url: "https://www.nutrient.io/guides/ios/annotations/annotation-flags/"
md_url: "https://www.nutrient.io/guides/ios/annotations/annotation-flags.md"
last_updated: "2026-05-21T11:22:21.601Z"
description: "Learn to define annotation behavior in PDFs on iOS by using flags. Control visibility, printing, editing, and zooming for optimal user interaction and experience."
---

# Define annotation behavior with flags on iOS

Every [`Annotation`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation) in a document can specify flags that further define its behavior and capabilities. With Nutrient, you can access these flags directly on your annotation objects using the [`flags`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flags) property.

## 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.Flag.invisible`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag/invisible) flag will ignore annotation appearance streams.

- An annotation with a flag set to [`Annotation.Flag.hidden`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag/hidden) won’t be displayed or printed.

- An annotation with an [`Annotation.Flag.print`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag/print) flag will be printed. [`Annotation.Flag.print`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag/print) is the default flag.

- An annotation with a flag set to [`Annotation.Flag.noView`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag/noview) won’t be displayed onscreen, but printing might be allowed.

- Annotations with an [`Annotation.Flag.readOnly`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag/readonly) flag don’t allow user interactions. The flag is ignored for [widget annotations](https://www.nutrient.io/api/ios/documentation/pspdfkit/widgetannotation).

- Annotations with an [`Annotation.Flag.noZoom`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag/nozoom) flag won’t be zoomed when the page is zoomed, i.e. the size of the annotation on the page will remain the same, irrespective of the zoom level. This flag is currently only supported for stamp annotations.

- If you want to prevent your users from editing an annotation, you can set the [`Annotation.Flag.locked`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag/locked) and [`Annotation.Flag.lockedContents`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag/lockedcontents) flags.

Check out the [`Annotation.Flag`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/flag) 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:

### SWIFT

```swift

// Create a new annotation.
let annotation = StampAnnotation(stampType:.confidential)

// Update the annotation flags.
annotation.flags.update(with: [.locked,.lockedContents])

// Add the newly created annotation to the document.
document.add(annotations: [annotation])

// To add an additional flag, use `update`.
annotation.flags.update(with:.hidden)

// To remove a flag, use `remove`.
annotation.flags.remove(.hidden)

```

### OBJECTIVE-C

```objc

// Create a new annotation.
PSPDFAnnotation *annotation = [[PSPDFStampAnnotation alloc] initWithStampType:PSPDFStampTypeConfidential];

// Update the annotation flags.
annotation.flags |= PSPDFAnnotationFlagLocked | PSPDFAnnotationFlagLockedContents;

// Add the newly created annotation to the document.
[document addAnnotations:@[annotation] options:nil];

// To add an additional flag, use bitwise OR with the flag value.
annotation.flags |= PSPDFAnnotationFlagHidden;

// To remove a flag, use bitwise AND with the reverse flag value.
annotation.flags &= ~PSPDFAnnotationFlagHidden;

```
---

## Related pages

- [Annotations object model on iOS](/guides/ios/annotations/the-annotation-object-model.md)
- [How to embed files in PDF annotations on iOS](/guides/ios/annotations/create-edit-and-remove/attach-a-file.md)
- [Setting annotation authors on iOS](/guides/ios/annotations/annotation-author-name.md)
- [Defining annotation blend modes on iOS](/guides/ios/annotations/annotation-blend-modes.md)
- [Detect changes to PDF annotations in iOS apps](/guides/ios/annotations/detecting-if-annotations-have-changed.md)
- [Drag-and-drop annotations on iOS](/guides/ios/annotations/create-edit-and-remove/drag-and-drop.md)
- [Disable PDF annotation editing for iOS users](/guides/ios/annotations/create-edit-and-remove/disable-editing.md)
- [Programmatically create PDF annotations on iOS](/guides/ios/annotations/programmatically-creating-annotations.md)
- [Image picker: Add image annotations to PDFs on iOS](/guides/ios/miscellaneous/image-picker.md)
- [Annotation state manager on iOS](/guides/ios/annotations/annotation-state-manager.md)
- [Z-index for annotation stacking order on iOS](/guides/ios/annotations/annotation-z-index.md)
- [Undo and redo annotations on iOS](/guides/ios/features/undo-redo.md)

