I have to take e-signature from the user on a pdf file.
I am using https://www.npmjs.com/package/react-signature-canvas.
Right now, when the user digitally signs the document, I save it as base64 code in the database using toDataURL
function of the react-signature-canvas
I want the signature to also contain the date and time of signing, such that the generated base64 already contains the date time. Is there any way to achieve this?
Asked
Active
Viewed 594 times
0

Abhishek Singhal
- 58
- 6
1 Answers
0
toDataURL()
only returns the encoded base64 representation of the image and by that the signature. So no other information. The best way for you would be probably to save the timestamp into the database when the signature was added.
(In general it's not the best practise to save images as raw data into the database. It would be even better to save it on e.g. AWS S3 which then contains meta information such as created at by default. Also you could potentially attach more meta data to it. The AWS S3 path you in the end then only reference to your database record.)

Max Schmitt
- 2,529
- 1
- 12
- 26
-
I was thinking of somehow adding the timestamp to the canvas element and then calling ```toDataURL()```. Since I am already using AWS S3, using meta-information might be a good way to go. – Abhishek Singhal Jun 19 '20 at 13:37