问题
I have found this post that explains how to extract the text from a pdf in javascript, but I would like to know if it's possible to extract only the text selected by the user.
回答1:
You can not.
The PDF, unless it's being rendered by a javascript renderer (as-in, pdf.js), can not be accessed at all by the browser's javascript.
This is because it's being rendered by a browser plugin that the javascript is intentionally not allowed to access.
Your post is tagged with "google-chrome-extension" and "google-chrome" but your question does not mention these. You might not be asking a specific enough question.
来源:https://stackoverflow.com/questions/17774634/is-it-possible-to-extract-the-text-selected-by-the-user-in-a-pdf