Annotation flags
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
noViewflag hides an annotation in the UI, but the annotation may still print. - Users can’t click annotations with
noView, andsetSelectedAnnotationsthrows for them. - The
noPrintflag prevents printing. - The
noZoomflag prevents magnification when users zoom in. - Nutrient Web SDK currently supports
noZoomonly forStampAnnotationandTextAnnotation. - This support excludes
TextAnnotationobjects with thecalloutproperty set. - Nutrient Web SDK doesn’t currently support the
noRotateflag. - The PDF specification treats note annotations as if
NoRotateis always set. - Nutrient Web SDK always renders
NoteAnnotationicons upright. - The
readOnlyflag set totrueprevents user input. - Users can’t select, edit, or delete read-only annotations.
- The
lockedflag set totrueprevents deletion and editing. - The
lockedflag doesn’t restrict content changes, such as text changes in a text annotation. - The
lockedContentsflag set totruekeeps 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(...);// 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(...);