DanielArnould / react-pdf-highlighter-extended

📄 Set of modern React components for PDF highlighting
https://danielarnould.github.io/react-pdf-highlighter-extended/example-app/
MIT License
43 stars 16 forks source link

Question: how can I calculate the position for some given text? #19

Open phritz opened 1 month ago

phritz commented 1 month ago

Hi, new to this repo and pdf.js generally so apologies for the newb question. I have some text that i know appears in a PDF and the page number on which it appears. What's the mechanism by which I can determine the position for the text? For example the position of the text in the example app: https://github.com/DanielArnould/react-pdf-highlighter-extended/blob/b58a3b387d870a44051a7d032e5f67ecabeb7909/example/src/test-highlights.ts#L10. How do I determine those rects and boudingrects?

Thank you!

AndTmf commented 1 month ago

I don't know if it helps you but the coordinates of the rects are in inches multiplied by the standard dpi of 72