2

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.

  • 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 Jan 18 '20 at 16:26
  • 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 https://www.pdfescape.com/. – sajjad aslam Jan 18 '20 at 16:28

1 Answers1

0

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

Bharat Vasant
  • 850
  • 3
  • 12
  • 46
  • Yes I would like to do that. But can u please suggest any PDF Viewer? or any tutorial how its done please? Thank you – sajjad aslam Jan 22 '20 at 16:26
  • Well, google search for "Web PDF Viewer for .net or say your platform". One such PDF viewer I know is by Syncfusion but it's a paid one... you may search one that suits your requirement and budget or free one... – Bharat Vasant Jan 23 '20 at 09:01