How can I "require" a signature?

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
8.2.0

Detailed description of issue
When viewing forms created with Acrobat Pro DC containing signature fields marked as required, how can I check to see that the required signatures were created in PDF.js Express Plus?

Code snippet

fieldManager.forEachField(field => {
    const is_required = field.flags.get('Required')

    if (!is_required) {
        return
    }

    const field_type = field.getFieldType()

    // text boxes
    if (field_type == 'TextFormField' && (field.value === null || field.value.trim() == '')) {
        // ...

    // checkboxes
    } else if (field_type == 'CheckBoxFormField' && field.value == 'Off') {
        // ...

    // radio buttons
    } else if (field_type == 'RadioButtonFormField' && field.value == 'Off') {
        // ...
    }

    // signature fields aren't form fields, or they were replaced with annotations,
    // so I cannot check if a required signature field still needs to be signed or not
})

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

I found something that works but I am not sure if it’s the best way to go about it. I used the same method as Snap viewport to next unsigned signature

// iterate each annotation looking for signatures
instance.annotManager.getAnnotationsList().forEach(annotation => {
    if (annotation instanceof instance.Annotations.SignatureWidgetAnnotation) {
        const is_required = annotation.getField()?.flags.get('Required') || false
        const is_signed = !!annotation.annot

        if (is_required && !is_signed) {
            // ...
        }
    }
})

Scratch that - the Required property doesn’t get picked up, it seems

Hey there,

After a bit of investigation, this seems to be on issue on our end. The code you came up with should work, however for some reason we are not setting the Required flag on our end.

We look look into this and have it fixed up right away.

Thanks!
Logan

1 Like