Where did SignatureTool create and store its signatures?

Just want to confirm/clarify my thought: when user create a new signature using SignatureTool, it basically just create a new annotation, then that signature will be placed in the SignatureTool overlay menu dropdown. So when the user quits, all the signatures listed in that overlay dropdown will go away.

Is that correct?

So whether this flow be possible?

  1. User open a doc
  2. They create a new signature. We grab the newly created signature by trapping signature.on(‘signatureSaved’…), grab the created signature, send it to backend for save.
  3. The same user reopen some doc in the future
  4. We fetch the stored signature back from backend, then get PDFTron to list the signature (or signatures) to SignatureTool overlay dropdown.
  5. The pretty similar workflow used for saved signature deletion

If that flow possible, what API I could use to grab and render the stored sigs from backend to SignatureTool overlay dropdown? There were methods like initDefaultSignature (looks like its an old one?) described with a recommended steps in this discussion in step 3, I wonder if we had something like that equivalent for 6x version API?

TIA!

Hello,

Out of the box, the signatures are not permanently stored but you can definitely implement your own solution to store them.

The APIs you are looking for is actually on the tool and I have mentioned a bit of the process here: https://groups.google.com/forum/#!searchin/pdfnet-webviewer/andy$20signature|sort:date/pdfnet-webviewer/roZtmA1mzgw/NgNwGn76CgAJ. I only mentioned how to import but if you look in the API docs for the tool, there is also an exportSignatures. In summary, you will be using exportSignatures/importSignatures in combination with the API. There are also a lot of other helpful functions on the tool which may help if you are interested.

Let me know if this helps!

Andy Huang

Software Developer
PDFTron Systems Inc.

Hi Andy,

Looks like I have done it. I used exportSignatures from backend. Thank you. My next question would be, how to re-render the SignatureTool dropdown? I can see that the signatures has been imported to SignatureTool, but it wouldn’t shows up in the dropdown until I create another one in the editor. My first thought that perhaps I should reload the SignatureTool?

Hello,

That’s great to hear!

On the behavior you are seeing, I am not sure I see the same thing. I imported a signature I exported on documentLoaded as a test and I see it rendered in the saved signature preview:

docViewer.on(‘documentLoaded’, () => {
const sigTool = docViewer.getTool(‘AnnotationCreateSignature’);
sigTool.importSignatures(
[ // Array of Signatures
[ // Array of Paths
[ // Array of Points
// Points
]
]
]);
});

signature.gif

Would you mind sharing what you are seeing?

Edit: I put the GIF in the zip since it is not animating.

Andy Huang

Software Developer
PDFTron Systems Inc.

signature.zip (866 KB)

Hi Andy,

After checking your answer I realize my problem, it was my mistake, I place the function to load and import signatures in a wrong place. Since our PDF editor is using custom workflow, it won’t have the effect when I put that in documentLoaded event handler… Instead i place that inside my own handler for a custom event that triggered when user is activating “edit” mode. The GIF in zip file will give the illustration.

It is working now, thank you!

workingsigtooldropdown.zip (353 KB)