If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo
In PDF.js text selection works more smoothly than in react-pdf for my pdf (in Chrome)
I added a border to border to .textLayer span, and it seems like in pdf.js they pad text spans so they run into each other, making selection less jumpy, while in react-pdf when the mouse is over white spaces between elements selection behaves erraticaly.
The relevant code is in https://github.com/mozilla/pdf.js/blob/26ae50e4494aa57b31f305df759fb44ae8be4cd7/web/text_layer_builder.js , they call expandTextDivs onMouseDown. (when using enhanceTextSelection )
Can this be added to react-pdf?
Steps to reproduce
Open a pdf in react-pdf in Chrome
Select a text hovering on white spaces between lines/ over edges
Selection should run smoothly
selection jumps to end/start of page / paragraph
Browser (if applicable): Chrome 103
React-PDF version: ^6.0.0-beta.3
React version: 18.2.0
Webpack version (if applicable): 5
The text was updated successfully, but these errors were encountered:
Adds an element behind text items that expands on mouse down. This especially improves text selection behavior on Firefox where elements with user-select: none prevent selection from being updated.