PDF form field flags
Form fields inherit annotation flags through their associated widget annotations, and you can configure separate flags on each form field.
Inherited annotation flags
Each Annotation in a document can specify flags that define its behavior. Access these flags through the corresponding annotation properties.
Capabilities of flags
Annotation flags come from the PDF specification, and they control how annotations appear onscreen and on paper. They also control which editing features users can access.
Use flags for the following behavior:
- The
noViewflag hides an annotation in the UI, but the annotation may still print. - Widget annotations aren’t selectable outside Form Designer, regardless of the
noViewflag. - The
noPrintflag prevents printing. - 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.
Setting annotation flags
Set annotation flags before you create or update an annotation. The following example sets noView to true before creating an annotation:
// 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 specification. They all default to false:
noExport— Iftrue, exports exclude the form field.readOnly— Iftrue, users can’t modify the form field value.required— Iftrue, users must fill out the form field before submitting the form.
Modify form field flags the same way you modify annotations. The following example sets noExport to true:
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));});