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 noView flag won’t be rendered in the UI but may be printable.

  • An annotation with the noPrint flag won’t be printed.

  • An annotation with the noRotate flag 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 for NoteAnnotation.

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 PSPDFKit.Annotations.RectangleAnnotation({
		pageIndex: 0,
		boundingBox: new PSPDFKit.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.

Form Field Flags

Form field flags determine a form field’s behavior according to the PDF spec. They all default to false:

  • noExport — If true, the form field can’t be exported.

  • readOnly — If true, the form field value can’t be modified.

  • required — If true, 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:

PSPDFKit.load().then(async (instance) => {
	const formFields = await instance.getFormFields();
	if (formFields.size === 0) {
	const formField = formFields.first();
	instance.update(formField.set('noExport', true));