PDF form field flags
Form fields inherit annotation flags through their associated widget annotations.
Inherited annotation flags
Every Annotation in a document can specify flags that further define its behavior and capabilities. These flags can be accessed directly on each annotation through the corresponding properties.
Capabilities of flags
Annotation flags are part of the PDF specification and define the annotation’s behavior, its presentation on a screen 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. - Web SDK doesn’t currently support the
noRotateflag. Per the PDF specification, note annotations behave as ifNoRotatewere always set, soNoteAnnotationicons are always rendered upright.
Setting annotation flags
Here’s an example of how to create a non-viewable annotation by setting the corresponding noView flag:
// Create a new annotation.let annotation = new NutrientViewer.Annotations.RectangleAnnotation({ pageIndex: 0, boundingBox: new NutrientViewer.Geometry.Rect({ left: 200, top: 150, width: 250, height: 75 }) })});
// Update the annotation flags.annotation = annotation.set("noView", true);
// Add the newly created annotation to the document.instance.create(annotation);Form field flags
Form field flags determine a form field’s behavior according to the PDF spec. They all default to false:
noExport— Iftrue, the form field can’t be exported.readOnly— Iftrue, the form field value can’t be modified.required— Iftrue, the form field must be filled out to submit the form.
You can modify the form field flags similar to how you would modify annotations:
NutrientViewer.load().then(async (instance) => { const formFields = await instance.getFormFields(); if (formFields.size === 0) { return; } const formField = formFields.first(); instance.update(formField.set('noExport', true));});