Adding a Signature Field to a PDF Form

A signature form field can be added to a PDF document programmatically or by using the built-in user interface. Here’s how to programmatically add a signature form field, which can then be used as a placeholder for electronic signatures:

const widget = new PSPDFKit.Annotations.WidgetAnnotation({
  id: PSPDFKit.generateInstantId(),
  pageIndex: 0,
  boundingBox: new PSPDFKit.Geometry.Rect({
    left: 200,
    top: 300,
    width: 150,
    height: 75
  }),
  formFieldName: "my signature form field"
});
const formField = new PSPDFKit.FormFields.SignatureFormField({
  name: "my signature form field",
  annotationIds: new PSPDFKit.Immutable.List([widget.id])
});
await instance.create([widget, formField]);