Digital Signing with Web SDK

Product: Digital Signing

Product Version: Latest

Please give a brief summary of your issue:
Digital Signing the same signature field more than once.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
I have signed a document digitally as described in the documentation, so when signed and reopen the document the indicator (Sign Here) shows again in the signed signature field in some cases, so I can sign the same field more than once.

Please provide a link to a minimal sample where the issue is reproducible:

  const SignPDF = async (in_docpath, in_approval_field_name, in_private_key_file_path, 
  in_keyfile_password, in_appearance_img_path, in_outpath) => {
  
  // Open an existing PDF
  const doc = await PDFNet.PDFDoc.createFromURL(in_docpath);
  doc.initSecurityHandler();
  doc.lock();

  // Retrieve the unsigned approval signature field.
  const found_approval_field = await doc.getField(in_approval_field_name);
  const found_approval_signature_digsig_field = await PDFNet.DigitalSignatureField.createFromField(found_approval_field);

  // (OPTIONAL) Add an appearance to the signature field.
  const img = await PDFNet.Image.createFromURL(doc, in_appearance_img_path);
  const found_approval_signature_widget = await PDFNet.SignatureWidget.createFromObj(await found_approval_field.getSDFObj());
  await found_approval_signature_widget.createSignatureAppearance(img);

  // Prepare the signature and signature handler for signing.
  await found_approval_signature_digsig_field.signOnNextSaveFromURL(in_private_key_file_path, in_keyfile_password);

  // The actual approval signing will be done during the following incremental save operation.
  const docbuf = await doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_incremental);
  saveBufferAsPDFDoc(docbuf, in_outpath);

  console.log('================================================================================');

  return docbuf;
};


As shown here in the Digital Signature demo.

Hi there,
Thank you for contacting us. We are able to reproduce this problem and will be working on a fix. We will get back to you again as soon as the issue is fixed.

Regards,
Yixiao

Thank you for replying to me, I’m waiting for you.

Regards

@ychen Is this issue fixed?

Hey there,

Based on the current backlog status, we expect this issue to be fixed in the middle of this month. When the issue is fixed, it will be available in our stable nightly build right away. We will be in touch with you again for how you can access it by then.

Regards,
Yixiao

Thank you for replying to me, I’m waiting for you.

Hey there,

I just heard back from our development team for an update: the issue you described in this ticket is actually an expected behaviour. The option to show / hide the “Sign Here“ indicator is serialized alone with the form field widget, so If you wish to disable the indicator, you can do so with method formFieldCreationManager.setShowIndicator in the document loading process. Adding the following code into your application should help you to resolve this issue:

instance.Core.documentViewer.addEventListener("annotationsLoaded", () => {
  const signedWidgets = instance.Core.annotationManager
    .getAnnotationsList()
    .filter(
      (annot) =>
        annot.getAssociatedSignatureAnnotation &&
        annot.getAssociatedSignatureAnnotation() &&
        annot.fieldName
    );

  const signedFieldNames = signedWidgets.map((annot) => annot.fieldName);
  const smg = instance.Core.annotationManager.getFormFieldCreationManager();
  smg.startFormFieldCreationMode();
  const placeHolderAnnots = {};
  instance.Core.annotationManager.getAnnotationsList().forEach((annot) => {
    if (annot.getFormFieldPlaceHolderType() === "SignatureFormField") {
      placeHolderAnnots[annot.getCustomData("trn-form-field-name")] = annot;
    }
  });
  signedFieldNames.forEach((fieldName) => {
    const signaturePlaceHolder = placeHolderAnnots[fieldName];
    smg.setShowIndicator(signaturePlaceHolder, false);
  });
  smg.endFormFieldCreationMode();
});

Hey there,
I do not understand how this is expected behavior, but I have tried the code above but still shows a sign here indicator after digitally signing the field.

Hey there,
This code is not solved my problem, the Sign Here indicator still shows.