Annotation flags
Every 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 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
noViewflag won’t be rendered in the UI but may be printable. - An annotation with the
noPrintflag won’t be printed. - An annotation with the
noZoomflag won’t be magnified when zooming in. This is currently only enabled forStampAnnotationandTextAnnotation(with the exception ofTextAnnotations with thecalloutproperty set). - An annotation with the
noRotateflag 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 forNoteAnnotation. - An annotation with the
readOnlyflag set totruewon’t respond to user inputs. It isn’t selectable, editable, or deletable. - An annotation with the
lockedflag set totruecannot 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
lockedContentsflag set totruecan 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:
// 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(...);