This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/annotations/annotation-flags.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Customizing PDF annotation flags using JavaScript | Nutrient

Each Annotation in a document can specify flags that define its behavior, and Nutrient Web SDK exposes these flags as properties on annotation records.

Capabilities of flags

Annotation flags come from the PDF specification, and they control how annotations appear onscreen and on paper. They also define which editing actions users can take.

Use flags for the following behavior:

  • The noView flag hides an annotation in the UI, but the annotation may still print.
  • Users can’t click annotations with noView, and setSelectedAnnotations throws for them.
  • The noPrint flag prevents printing.
  • The noZoom flag prevents magnification when users zoom in.
  • Nutrient Web SDK currently supports noZoom only for StampAnnotation and TextAnnotation.
  • This support excludes TextAnnotation objects with the callout property set.
  • Nutrient Web SDK doesn’t currently support the noRotate flag.
  • The PDF specification treats note annotations as if NoRotate is always set.
  • Nutrient Web SDK always renders NoteAnnotation icons upright.
  • The readOnly flag set to true prevents user input.
  • Users can’t select, edit, or delete read-only annotations.
  • The locked flag set to true prevents deletion and editing.
  • The locked flag doesn’t restrict content changes, such as text changes in a text annotation.
  • The lockedContents flag set to true keeps the annotation editable and deletable.
  • Users can’t edit or delete its text content.

Setting annotation flags

Set flags before you create or update an annotation, and use set to change each flag value. The following example sets noView to true before adding the annotation:

// 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(...);