I'm new so please forgive any mistakes. I am making an application in laravel where admin uploads pdf, the user views it and digitally sign the pdf. I cat understand how to get the digital signature on top of the pdf. I have made the pdf in HTML and added the digital signature through the canvas in it and use the code to print out the HTML as pdf. But this is what the client says, "I want the admin to just upload any pdf. The user should be able to draw anywhere on the pdf". Can anyone help what approach should I use? I am thinking of converting the pdf to image on upload. then use it as a background on the canvas and make canvas drawable. and then convert that image back to pdf after the user confirms the sign. But I am still unable to get anywhere. Can anyone help me please? An idea or approach that you can tell me. Thanks, A Lot.
2
votes
i think your idea of converting to image and using as background sounds good. What do you mean you are "unable to get anywhere"?
– maximus1127
I can convert the pdf to image and image back to pdf. But in between, I'm unable to get the canvas work(drawable) when there is an image on its bg. But overall its a long and complex way. I want to know if there is a better way. Something like pdfescape.com.
– sajjad aslam
1 Answers
0
votes
I would suggest to use any PDF Viewer Web library to display the PDF in client's browser. There user would be able to draw rectangle using his mouse or any image (If you want, you may put user's scanned signature there... or Text of Signature to be displayed...)
From this, you would have x and y coordiantes on the pdf and height and width of signature.
You may send this back to server where you are creating signature. If you also want to read signature from the client's USB token or smart card connected to his browser, you may use browser extension. For more details on this, please refer to my SO answer https://stackoverflow.com/a/55676351/9659885