title: How do I retrieve text from user selection in pdf.js?
body: <p>This question is specific to pdf.js, a javascript based pdf renderer. I'm building a custom version where I need to extract the text that I select inside the pdf. </p>
  
  <p>There are other posts where you can fetch the text from one page or the whole pdf document such as the one <a href="https://stackoverflow.com/questions/1554280/extract-text-from-pdf-in-javascript">here</a> , but I'm looking to grab a specific text that the user selects and perhaps alert it or print it in the console.</p>