---
title: "Add signature fields to PDF on iOS"
canonical_url: "https://www.nutrient.io/guides/ios/forms/create-edit-and-remove/add-signature-field/"
md_url: "https://www.nutrient.io/guides/ios/forms/create-edit-and-remove/add-signature-field.md"
last_updated: "2026-06-08T09:14:14.401Z"
description: "Learn how to programmatically add signature fields to PDF forms on iOS for electronic and digital signing. Follow our detailed guide now."
---

# Programmatically add signature fields to PDF forms

Programmatically creating form fields can be useful when a PDF document needs to be electronically signed or digitally signed but doesn’t contain a signature field.

A document can still be digitally signed even when it doesn’t have a signature form element.

A form field is a model representation of a visual form in a document. To be able to create a signature form field, you have to first create a [`SignatureFormElement`](https://www.nutrient.io/api/ios/documentation/pspdfkit/signatureformelement) (a type of widget annotation). This works the same as adding any other annotation, as can be seen in our guide on [programmatically creating annotations](https://www.nutrient.io/guides/ios/annotations/programmatically-creating-annotations.md). For more information on the difference between a form field and a form element, see our guide on [forms](https://www.nutrient.io/guides/ios/forms/introduction-to-forms.md).

When the form element has been added to the document on the correct page, you can call [`insertedSignatureField(withFullyQualifiedName:documentProvider:formElement:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/signatureformfield/insertedsignaturefield(withfullyqualifiedname:documentprovider:formelement:)) on [`SignatureFormField`](https://www.nutrient.io/api/ios/documentation/pspdfkit/signatureformfield). Note that this can fail, and you’ll need to check that the return value isn’t `nil`:

### SWIFT

```swift

// Create a new signature form element.
let signatureFormElement = SignatureFormElement()
// Position it in the document.
signatureFormElement.boundingBox = CGRect(x: 100, y: 100, width: 100, height: 20)
// Add it to the third page.
signatureFormElement.pageIndex = 2

// Insert a form field for the form element.
let signatureFormField = try! SignatureFormField.insertedSignatureField(withFullyQualifiedName: "Digital Signature", documentProvider: documentProvider, formElement: signatureFormElement)

```

### OBJECTIVE-C

```objc

// Create a new signature form element.
PSPDFSignatureFormElement *signatureFormElement = [[PSPDFSignatureFormElement alloc] init];
// Position it in the document.
signatureFormElement.boundingBox = CGRectMake(100.f, 100.f, 100.f, 20.f);
// Add it to the third page.
signatureFormElement.pageIndex = 2;

// Insert a form field for the form element.
NSError *error;
PSPDFSignatureFormField *signatureFormField = [PSPDFSignatureFormField insertedSignatureFieldWithFullyQualifiedName:@"Digital Signature" documentProvider:documentProvider formElement:signatureFormElement error:&error];
if (!signatureFormField) {
    // Handle error.
}

```

When creating a form field just before digitally signing a document, call `try document.save()` before signing the document to ensure the inserted signature form field is correctly added to the document. Otherwise, the appearance of the signed form field could stay empty.
---

## Related pages

- [How to disable PDF form editing on iOS devices](/guides/ios/forms/create-edit-and-remove/disable-editing.md)
- [PDF form field editor on iOS](/guides/ios/forms/create-edit-and-remove/edit-fields.md)
- [Creating fillable PDF forms on iOS](/guides/ios/forms/form-creation.md)
- [PDF form field flags on iOS](/guides/ios/forms/create-edit-and-remove/form-field-flags.md)
- [Form object model on iOS](/guides/ios/forms/create-edit-and-remove/form-object-model.md)

