I have using the PDFJS rightnow
i want to get the selected text from the PDFJS viewer and pass the text element to the HTML page(may be is one hidden element)
i try to use the javascript on the web, but these can not select the text from the viewer
What can i do for this?
@macarlos2005: first, could you please change the issue title to lowercase? Much nicer to read that way :)
Secondly, it is not entirely clear to me what you want exactly. Do you mean that you cannot select text in the viewer? If so, could you post a PDF file that causes selection problems?
The PDF.js viewer creates text layer, which is a hidden HTML DIV element. You can take this element and pass it to the HTML page. The text layer might not be present for scanned image. Closing as answered and out of scope.
If you render each page in the pdf with separate div and some css you will then be able to select the text directly in the browser. It is then easy tou use ordinary javascript to get the selected text.
This article explain rendering. Custom PDF Rendering in JavaScript with Mozilla鈥檚 PDF.Js
If you render each page in the pdf with separate div and some css you will then be able to select the text directly in the browser.
@petterivarsson how it's different from what demo viewer is doing? (or examples at examples/components)?
@yurydelendik Nothing more than to explain in a it more educational manner for people like me who are web-noobs.
We need more low-level API usage examples in order to make creative use cases. I like the recommended article.
Most helpful comment
@yurydelendik Nothing more than to explain in a it more educational manner for people like me who are web-noobs.