How to remove "Sign here" button/field inside the PDF?

Hi,
How to remove the “Sign here” button/field inside this PDF?
Note: I’m using Angular 12.

Hello,

You will have to remove the annotation or attempt to hide it. This depends on what you need to do.

To remove the annotation, you can loop through the annotation list and remove any signature widgets (or a specific widget if you know the field name):

const { Annotations, annotationManager } = instance.Core;
annotationManager.getAnnotationsList().forEach(annot => {
    if (annot instanceof Annotations.SignatureWidgetAnnotation) {
        annotationManager.deleteAnnotation(annot);
    }
});

You can try to change the style or even the elements that are rendered by following this guide: PDFTron.

Let me know if this helps!

Hi Andy,
Thanks for your response. I tried this method but it worked partially. I mean, only the first row (“sign here” field) has been removed. I want to remove every “Sign here” field.


Also, now after removing the “Sign here” field, How can I know the field name? (I want to add a simple Annotation text field instead of the “Sign here” field).

Hello,

That’s odd. I can reproduce what you saw and I will have to look a bit deeper into whether that is a bug or not. For now, you can use the deleteAnnotations API instead. You can get the field name from the fieldName property of the annotation. Using our guide: PDFTron, you can replace the signature widget with a text field widget using the same field.

const { Annotations, annotationManager } = instance.Core;
const widgets = [];
annotationManager.getAnnotationsList().forEach(annot => {
    if (annot instanceof Annotations.SignatureWidgetAnnotation) {
        widgets.push(annot);
    }
});
widgets.forEach(annot => {
    const field = annotationManager.getFieldManager().getField(annot.fieldName);
    const widgetAnnot = new Annotations.TextWidgetAnnotation(field);

    widgetAnnot.PageNumber = annot.PageNumber;
    widgetAnnot.X = annot.X;
    widgetAnnot.Y = annot.Y;
    widgetAnnot.Width = annot.Width;
    widgetAnnot.Height = annot.Height;

    annotationManager.addAnnotation(widgetAnnot);
    annotationManager.drawAnnotationsFromList([widgetAnnot]);
})
instance.Core.annotationManager.deleteAnnotations(widgets);