0

I'm trying to do something but have little idea of how to achieve it. Namely, i' trying to capture the index of where in a pdf document (loaded on the web page) the user's mouse was clicked and where it was released.

Example:

"This is a great placeholding text that serves as an example"

Say the user highlights the substring "great placeholding text", how can I capture:

  • the content of the highlighted text, in this example "great placeholding text"

  • The index at which the mouse was pressed and released

In essence I'm trying to allow users to highlight and easily save parts of the pdf document (as well as the position of the portion of text they have saved) for later reference.

Any ideas would be much much appreciated, thanks all!

Max
  • 163
  • 1
  • 12
  • The PDF is not in the DOM - it's in a plugin wrapper. You'd have to script this in the PDF itself. – Diodeus - James MacFarlane Jul 17 '13 at 17:45
  • I'm not sure if i understand correctly... How can I script this inside a pdf? Is it possible to somehow inject code in the file? – Max Jul 17 '13 at 17:50
  • The script would have to be in the PDF itself, so that's probably not a good solution. The other option seems to be doing part of it on the server: http://stackoverflow.com/questions/15711729/extract-area-from-pdf – Diodeus - James MacFarlane Jul 17 '13 at 17:53
  • To expand on the answer (or question for that matter) ... what user? Using what to view the PDF? Are you giving them a link to a PDF file (which means whatever method their browser/system uses for viewing PDF launches)? Are you converting the PDF server-side to HTML to display? If you merely have a link to the PDF ... iin what way do you know that PDF is being displayed by the end user ... they may have no PDF viewer installed, or Adobe, or Nitro or something else. You have a question that has no answer until you determine whether you have control of the situation in which they view the PDF. – Kevin Brown Jul 17 '13 at 23:57

0 Answers0