Hello,
after my last issue has been resolved, I’ve ran into a new one. Hopefully this will be the last thread from me, since the implementation of Apryse is almost done.
In the document there are two signature fields. When I close the WebViewer, the document gets saved like this:
const doc = documentViewer.getDocument();
const xfdfString = await annotationManager.exportAnnotations();
const options = { xfdfString };
const data = await doc.getFileData(options);
const arr = new Uint8Array(data);
this.finalBlob = new Blob([arr], { type: ‘application/pdf’ });
this.closePage(this.finalBlob, signatureAdded);
I want the added signatures to be deleted, if the document gets opened in the WebViewer again.
I’ve tried it like this:
documentViewer.addEventListener(‘annotationsLoaded’, () => {
const signatureWidgetAnnots = annotationManager.getAnnotationsList()
.filter(annot => annot instanceof Annotations.SignatureWidgetAnnotation) as Annotations.SignatureWidgetAnnotation;
signatureWidgetAnnots.forEach(annot => {
annot.clearSignature(annotationManager);
});
});
However, this doesn’t work. So I added following console.log to check if the fields are signed:
console.log("annot signed: " + annot.isSignedByAppearance());
I put this console.log at the end of the saving process, right before this.closePage gets called and the output of isSignedByAppearance() is “true”.
I also put the same console.log to the beginning, right after annotationsLoaded. When I save the document, the output is “true”. When I then open it again in the WebViewer, the output is “false”.
So suddenly, the fields are not signed by appearance anymore.
Also, if i put the annot.clearSignature at the end of the saving process, so right before this.closePage, the method works and the signatures are cleared. But it doesn’t work when I put it at the start, after annotationsLoaded.
How can I fix that?