Hi, guys. I am working on documents signature implementation. It have few steps:
User see PDF file and should tap on the place where signature should be placed. On this step I'm using https://github.com/wonday/react-native-pdf this library to display document and take tap's coordinates.
After step 1 I navigate user to the screen where he should draw his signature.
After user draw signature I'm using pdf-lib drawImage() method to sign document.
There is few problems in this approach:
0, 0 coordinates from react-native-pdf are in top left corner and as I understand coordinates are in pixels.
pdf-lib as I found out is using 1/72 inch as measurements units and 0, 0 point is in bottom left corner.
As result I can sign the document but with wrong placement of signature. So I need some way to properly convert coordinates taken from react-native-pdf to coordinates that are used by pdf-lib to place signature.
I already tried a lot of variants but no one works fine. In current implementation I'm using formula like this:
(pageHeight - signatureCoords.y) / (160 * PixelRatio.get()) / 72
So maybe someone can give me an advice how to properly place signature in PDF?
Hi, guys. I am working on documents signature implementation. It have few steps:
User see PDF file and should tap on the place where signature should be placed. On this step I'm using https://github.com/wonday/react-native-pdf this library to display document and take tap's coordinates. After step 1 I navigate user to the screen where he should draw his signature. After user draw signature I'm using pdf-lib drawImage() method to sign document. There is few problems in this approach:
0, 0 coordinates from react-native-pdf are in top left corner and as I understand coordinates are in pixels. pdf-lib as I found out is using 1/72 inch as measurements units and 0, 0 point is in bottom left corner. As result I can sign the document but with wrong placement of signature. So I need some way to properly convert coordinates taken from react-native-pdf to coordinates that are used by pdf-lib to place signature. I already tried a lot of variants but no one works fine. In current implementation I'm using formula like this: (pageHeight - signatureCoords.y) / (160 * PixelRatio.get()) / 72 So maybe someone can give me an advice how to properly place signature in PDF?