I’m working on a web application where users need to interact with PDF documents. Specifically, I need to detect the text that a user selects within a PDF displayed in their web browser. While I’ve managed to achieve this functionality with DOCX files.
I’ve tried using PDF.js to render the PDF in the browser, but I’m struggling to detect the text that users select. My goal is to capture the selected text .
Here are the main points I need help with:
How can I detect the text that a user selects in a PDF rendered in the web browser?
- Is it possible to achieve this using JavaScript or Python, and if so, how?
- I’ve looked into PDF.js and tried some examples, but I haven’t been successful in capturing the selected text.
Any guidance, code snippets, or references to relevant libraries or techniques would be greatly appreciated.
Additionally, I previously asked a similar question but using Python and django but haven’t received any answers yet. Here is the link to that question for more context: text.