I am pretty new to PDFTron. Currently I am checking WebViewer 6.1.0 for our requirement.
I would need to preload signature images of current user from server to Signature tool upon loading the WebViewer.
Could you please help me accomplish this? Is there any api available for this?
Any help on this would be greatly appreciated.
It is possible to load the images into the signature tool!
You will have to first fetch the image data and convert it to a base64 string. Next, you should increase the max signature count in WebViewer if you have more than two signatures: https://www.pdftron.com/api/web/WebViewerInstance.html#setMaxSignaturesCount__anchor. You can then get the signature tool from the document viewer using docViewer.getTool(‘AnnotationCreateSignature’) to start adding signatures.
There are two methods to adding signatures as there are two different APIs for this. They are both found on the SignatureCreateTool returned by getTool. The first and recommended option is to use importSignatures which takes an array of strings (base64) or an array of array points: https://www.pdftron.com/api/web/Tools.SignatureCreateTool.html#importSignatures__anchor. I recommend this option as it is more direct. The second option is to create the SignatureAnnotation/FreeHandAnnotation manually and use saveSignatures method to add them.
Let me know if this helps!
PDFTron Systems Inc.
I will try this options and let you know.