react-pdf-highlighter icon indicating copy to clipboard operation
react-pdf-highlighter copied to clipboard

Different coordinates while highlighting the same pdf

Open gautampramesh opened this issue 5 years ago • 4 comments

I am highlighting a pdf using this tool in browser. My other use case is to pass the required highlights from backend and render in browser. However for the same text highlighted coordinates in browser are different than the coordinates passed from backend. Python fitz module is used to send the highlight coordinates from backend. As I missing something here that needs to be considered while highlighting and rendering(eg: coordinate units or anything else)

gautampramesh avatar Oct 07 '20 12:10 gautampramesh

Have you looked into usePdfCoordinates?

davidkong0987 avatar Mar 15 '21 22:03 davidkong0987

Have you looked into usePdfCoordinates?

Could you explain a bit?

Dmarcotrigiano avatar Oct 13 '21 17:10 Dmarcotrigiano

An explanation on .usePdfCoordinates would be nice.

ch-hristov avatar Jan 23 '22 13:01 ch-hristov

This was a very long time ago so I apologize not remembering exactly how it works. However, I do not recommend using it unless you are willing to go in and edit the source code as there is an error with using usePdfCoordinates, which calls the pdfToViewport(scaled, viewport) function https://github.com/agentcooper/react-pdf-highlighter/issues/73

davidkong0987 avatar Jan 23 '22 15:01 davidkong0987

Fixed in #244.

agentcooper avatar Jul 31 '23 08:07 agentcooper