I
I
igor_solweb2020-11-02 15:51:03
JavaScript
igor_solweb, 2020-11-02 15:51:03

How to get selected text in pdf via JS?

Hello everyone, the situation is this:

there is a page, a pdf file is loaded onto it through <embed>or <iframe>, you can select text there, the pdf itself is displayed fine, but window.getSelection() does not work. I googled this question - it turned out that this can not be done, tk. thus, another page of another "window" is loaded through iframe or embed, can someone come across a similar one, how can I get this selected text from a window with pdf?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Filin Filin, 2020-11-02
@JSFilin

Maybe something like this?

document.querySelector("iframe").window.getSelection*(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question