0

I am writing a Chrome extension that manipulates PDF files and am looking to get all the text of a PDF file that's currently open in Chrome's PDF viewer.

I learned from How can I get selected text in pdf in Javascript? how to get selected text, but I couldn't find in the API a function that extracts the entire text (or better yet the PDF itself, and then send it to a server). Is it possible?

I am aware of the solution of sending the URL and downloading it on the server side, but sometimes it is problematic (e.g. PDFs from password-protected websites).

Thanks.

I have tried looking in the API, https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/resources/pdf/pdf_scripting_api.ts I have also tried "downloading" the PDF on client side and sending it as Blob to a server, but it's a problematic solution (sometimes blocked for example, requires extra permission).

  • This scripting_api has sendKeyEvent so maybe you can use it to select all text and then get the selection. – wOxxOm Feb 05 '23 at 12:06

0 Answers0