I'm using pdf.js with text selection.
So pdf.js creates a bunch of absolute positioned divs containing the various text from the pdf to supply text selection.
While dragging to select the text, the selection jumps to selecting everything to the top of the text, if you continue your selection into areas that are not text (like areas between paragraphs).
If you go to their example you can see what I'm describing. Try selecting text over several paragraphs in the left column and you'll see the selection "flicker" to selecting everything to top. http://mozilla.github.io/pdf.js/web/viewer.html
Any ideas on how to prevent this from happening? It is very distracting.
I think it has something to do with all of the divs holding the text being absolute.
Fixed: just add height:200px to
.textLayer > div {height:200px;}
in viewer.css
This is a bit old but still might be useful for some people. Setting textLayerMode
to 2 should fix that issue.
Example:
new PDFViewer({ ...otherProps, textLayerMode: 2 })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With