Annotation Flags

Every Annotation in a document can specify flags that further define its behavior and capabilities. With PSPDFKit, 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 the 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 flag will not be rendered in the UI but may be printable.
  • An annotation with the noPrint flag will not be printed.
  • An annotation with the noRotate flag will not change its rotation when a page rotation is specified. Instead, it will be locked to the top-left corner of its bounding box. This is currently only enabled for NoteAnnotation.

Setting Annotation Flags

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

Copy
1
2
3
4
5
6
7
8
// Create a new annotation.
let annotation = ...

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

// Add the newly created annotation to the document.
instance.createAnnotation(annotaiton).then(...);
Copy
1
2
3
4
5
6
7
8
// Create a new annotation.
var annotation = ...

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

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