Disable PDF form editing in React Native
Nutrient React Native SDK enables you to interact with forms in a document.
To disable form editing and interaction for your document, set the enableFormEditing configuration option to false, like so:
<NutrientView document={DOCUMENT} configuration={{ enableFormEditing: false, }} ref={this.pdfRef} fragmentTag="PDF1" style={{ flex: 1 }}/>Locking a single form field
enableFormEditing applies to the whole document. To lock one field while leaving the rest of the form fillable, use setFormFieldReadOnly with the field’s fully qualified name:
const forms = this.pdfRef.current?.getDocument().forms;
// Lock a single field.await forms.setFormFieldReadOnly('Name_Last', true);
// Unlock it again.await forms.setFormFieldReadOnly('Name_Last', false);The change applies at runtime and takes effect immediately — there’s no need to reload the document. Passing a name that doesn’t exist in the document rejects, so you can surface a clear error rather than silently doing nothing.
This is useful for workflows that progressively lock a form: for example, freezing the fields a user has already confirmed while the remaining ones stay editable.
Reading the read-only state back
Read the state back through getFormElements:
const elements = await this.pdfRef.current ?.getDocument() .forms.getFormElements();
const field = elements.find( (element) => element.formField?.fullyQualifiedName === 'Name_Last',);
const isReadOnly = field?.formField?.isReadOnly;The element-level FormElement.readOnly property reports the same state, so either property works:
const isReadOnly = field?.readOnly;FormElement.readOnly is only populated as of React Native 4.5.0. On earlier versions, it was never set and reported a locked field as editable, so prefer formField.isReadOnly if you support versions before 4.5.0.
Signature fields behave differently per platform
setFormFieldReadOnly is portable for value fields such as text fields and checkboxes. It is not portable for signature widgets:
- On iOS, a locked signature field swallows the tap before the SDK asks to present anything, so
onShouldShowSignaturePadnever fires. - On Android, the callback still fires, and allowing the request still opens the signature pad.
If your goal is to stop a user signing, don’t build it on read-only state — deny the request in onShouldShowSignaturePad instead, which behaves the same on both platforms. See gating the signature UI for the pattern.