---
title: "Customizing PDF annotation flags using JavaScript | Nutrient"
canonical_url: "https://www.nutrient.io/guides/web/annotations/annotation-flags/"
md_url: "https://www.nutrient.io/guides/web/annotations/annotation-flags.md"
last_updated: "2026-05-30T02:20:01.385Z"
description: "Customize PDF annotation flags using JavaScript to control visibility, printing, zooming, rotation, and editing features for a tailored user experience."
---

# Annotation flags

Every [`Annotation`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.html) 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 several properties in the annotation record.

## 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 the [`noView`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.Annotation.html#noView) flag won’t be rendered in the UI but may be printable.

- An annotation with the [`noPrint`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.Annotation.html#noPrint) flag won’t be printed.

- An annotation with the [`noZoom`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.StampAnnotation.html#noZoom) flag won’t be magnified when zooming in. This is currently only enabled for [`StampAnnotation`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.StampAnnotation.html) and [`TextAnnotation`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.TextAnnotation.html) (with the exception of `TextAnnotation`s with the [`callout`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.TextAnnotation.html#callout) property set).

- An annotation with the [`noRotate`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.Annotation.html#noRotate) flag won’t change its rotation when a page rotation is specified. Instead, it’ll be locked to the top-left corner of its bounding box. This is currently only enabled for [`NoteAnnotation`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.NoteAnnotation.html).

- An annotation with the [`readOnly`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.Annotation.html#readOnly) flag set to `true` won’t respond to user inputs. It isn’t selectable, editable, or deletable.

- An annotation with the [`locked`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.Annotation.html#locked) flag set to `true` cannot be deleted or edited. However, this flag doesn’t restrict changes to the annotation’s contents, such as the text of a text annotation.

- In contrast, an annotation with the [`lockedContents`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.Annotation.html#lockedContents) flag set to `true` can be edited or deleted, but its text content cannot be edited or deleted.

## Setting annotation flags

Here’s an example of how to create a non-viewable annotation:

### ES6+

```js

// Create a new annotation.
let annotation =...

// Update the annotation flags.
annotation = annotation.set("noView", true);

// Add the newly created annotation to the document.
instance.create(annotation).then(...);

```

### JAVASCRIPT

```js

// Create a new annotation.
var annotation =...

// Update the annotation flags.
annotation = annotation.set("noView", true);

// Add the newly created annotation to the document.
instance.create(annotation).then(...);

```
---

## Related pages

- [Add image annotations to PDFs using JavaScript](/guides/web/annotations/create-edit-and-remove/add-image.md)
- [Defining the author of an annotation](/guides/web/annotations/annotation-author-name.md)
- [Cut, copy, paste, and duplicate annotations in PDF using JavaScript](/guides/web/annotations/create-edit-and-remove/cut-copy-duplicate.md)
- [Create PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/create.md)
- [Detect changes in annotations](/guides/web/annotations/detecting-if-annotations-have-changed.md)
- [Edit PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/edit.md)
- [Select PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/multiple-selection.md)
- [Remove PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/remove.md)
- [Customizing annotation permissions](/guides/web/annotations/create-edit-and-remove/permissions.md)
- [Rich text in PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/rich-text.md)
- [Undo and redo annotations](/guides/web/annotations/create-edit-and-remove/undo-redo.md)

