To clean signature canvas

I have one signature field. see below.

When, I click ‘sign here’ button, signature dialog box will open. see below

Then ,I have created signature and dialog box closed. see below

Then, I deleted the signature, and again ‘sign here’ button showing. see below

Now ,I again clicked on ‘sign here’ button, dialog box opened. but dialog showing old signature which i signed before. I want to clean dialog box.


May I know which version of WebViewer are you using? I was trying with our online sample here JavaScript PDF Viewer Demo , but was not able to reproduce.



My pdftron WebViewer version is:

UI version ‘7.0.0’
Core version ‘7.0.0’

I have used below documentation:

sample my code:


css: ‘path/to/stylesheet.css’
}).then(instance => {
const { Tools, docViewer } = instance;
const signatureTool = docViewer.getTool(‘AnnotationCreateSignature’);

signatureTool.on(‘signatureSaved’, async () => {
const canvas = document.createElement(‘canvas’);
const pageMatrix = docViewer.getDocument().getPageMatrix(annotation[0].PageNumber);
canvas.height = annotation[0].Height+30;
canvas.width = annotation[0].Width > 145 ? annotation[0].Width : 145;
const ctx = canvas.getContext(‘2d’);
const date = new Date();
ctx.fillText(${date.toLocaleString()}, 0, annotation[0].Height+20, canvas.width);
annotation[0].draw(ctx, pageMatrix)
await signatureTool.setSignature(canvas.toDataURL());


I think you can just call signatureTool.clearSignatureCanvas() to clean the dialog box.


1 Like