Add handwritten signature image programmatically only client side, similar to the current uploading dialog

Hi Syncfusion team, is there a way to add handwritten signature (HWS) image programmatically on the client side?

My case as below:

- WebApp has a list of signature images (pre-uploaded)

- User choose one of signature image to append to their pdf instead of opening the HWS upload dialog to choose a file from their pc.

Trouble: don't which methods or functions of pdfviewer component able to add a HWS image 

Help please!


4 Replies

VS Vasugi Sivajothi Syncfusion Team June 24, 2022 10:50 AM UTC

Hi Ngoc,


You can add the image to the PDF document using the customStampSettings API. We have shared the sample for your reference, please refer to the below code snippet and sample.


Code Snippet:

 

viewer.customStampSettings = { customStamps: [{ customStampName: 'Image', customStampImageSource: 'data:image/jpeg;base64,…. },

    ],

  };

 


Sample: https://stackblitz.com/edit/angular-sjmpkf?file=app.component.ts


Documentation: https://ej2.syncfusion.com/angular/documentation/api/pdfviewer/customStampSettings/


Kindly try this and let us know if this helps you.



Regards,

Vasugi.



NG Ngoc June 24, 2022 10:59 AM UTC

Perfect! it worked



NG Ngoc June 26, 2022 12:31 PM UTC

Hi Vasugi. 

is there any way to make the added annotations be read-only (locked, cannot change anything: moving, deletion, etc ...) ?




VS Vasugi Sivajothi Syncfusion Team June 27, 2022 12:55 PM UTC

Hi Ngoc,


You can lock the added annotation using the isLock property. Please refer to the below code snippet and sample.


Code Snippet:

 

<button (click)="lockAnnotation()">LockAnnotation</button>

 

    lockAnnotation() {

    var viewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0];

    viewer.annotationCollection[0].annotationSettings.isLock = true;

    viewer.annotationModule.editAnnotation(viewer.annotationCollection[0]);

  }

 


Sample: https://stackblitz.com/edit/angular-sjmpkf-sohmtz?file=app.component.ts


Kindly try this and let us know if this helps you.


Regards,

Vasugi.


Loader.
Up arrow icon