Creating a PDF Form with Signature Form Fields

Illustration: Creating a PDF Form with Signature Form Fields

It’s easy to see that PSPDFKit supports form filling — just open up an AcroForm in PDF Viewer. What’s not as obvious is that our SDK also supports form creation. We’ve been rolling out support for this feature across all platforms, with the latest addition being signature support in our Web SDK.

PDFs with electronic signatures are on the rise, so let’s explore various ways to create a PDF form that can be signed.

PSPDFKit Form Designer

PSPDFKit for Web offers the convenient Form Designer, which supports dragging text and signature field elements on documents. You can try it out on our website!

This example will take you through a scenario where a user can insert form fields into a document to create a lease contract, with separate signing phases for the tenant and the landlord. The Form Designer component enables an extensive set of APIs for creating and editing various PDF widget types — including text fields, checkboxes, and signatures.

The PSPDFKit Form Designer supports both Server and Standalone deployments and can become an important part of your web document workflow.

Via the API

Form Creation via the PSPDFKit SDK is supported on Web, iOS, macOS, and Android. Note that creation is included in the regular Form license on iOS/macOS/Android, but it requires the Form Designer license on Web, since we have the best user experience there.

Here is an example of how to create a signature form field in multiple languages:

Copy
1
2
3
4
5
6
7
8
9
// 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)
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
// 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.
}
Copy
1
2
3
4
5
6
7
8
9
10
val page = 0
val rectFSignatureFormConfiguration = RectF(
    30f, // left
    190f, // top
    200f, // right
    160f // bottom
)
val signatureFormConfiguration = SignatureFormConfiguration.Builder(page, rectFSignatureFormConfiguration)
    .build()
val signatureFormField = document.formProvider.addFormElementToPage("signaturefield-1", signatureFormConfiguration)
Copy
1
2
3
4
5
6
7
8
9
10
11
int page = 0;
RectF rectFSignatureFormConfiguration = new RectF(
    30, // left
    190, // top
    200, // right
    160 // bottom
);
SignatureFormConfiguration signatureFormConfiguration = new SignatureFormConfiguration.Builder(page, rectFSignatureFormConfiguration)
    .build();
SignatureFormField signatureFormField = getDocument().getFormProvider().addFormElementToPage("signaturefield-1", signatureFormConfiguration);

With the PSPDFKit API, you can add all form field types (checkboxes, radio boxes, text fields, signature fields). Programmatic form filling is also supported — even in Java and .NET.

Adobe Acrobat Professional

Adobe Acrobat Pro DC fully supports creating AcroForms. However, it’s slightly hidden. Start with the Create Form dialog: (File > Create > Create Form…). Then, choose either an existing form or select Create New. Now, careful. It’s tempting to select This document requires signatures, however, this will start creating an Adobe Sign Form, which is a proprietary solution that won’t work anywhere except on Adobe’s website.

If your signature block shows a red sign arrow, you are in the correct AcroForm mode. Otherwise, use the small down arrow next to More to Convert the form to an AcroForm.

Conclusion

With the right tools, it’s easy to create AcroForms, and with PSPDFKit, you can sign them on all platforms. PSPDFKit offers the maximum level of flexibility to perfect workflows on any platform.

PSPDFKit Newsletter

Subscribe to our newsletter for more articles like this.