-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RangeFix.getClientRects(range) Not returning correct rects. #31
Comments
What are you using to render the PDF in the browser? |
We are using pdf.js library to render PDF. |
If I extract the HTML from the pdf.js render, I get all 3 rects in both FF and Chrome. If I run RangeFix inside the original pdf.js online viewer, I get 6 rects in both browser (maybe 3 more for the fake selection?) Can you provide a standalone example of the bug you describe, e.g. in a CodePen? |
Hi, Follow the same scenario on the Google Chrome browser, Firefox, and Edge browser. Note: I have verified on windows 10 Observation: Received clientRects from the Below code Google Chrome: 4 clientRects One more eg. select the first 4 lines from the document and check the console log on Chrome and Firefox it gives a different result. |
A minimal test case is:
In Chrome you get a rect for the text node "bar" as well as a rect for the I don't know which behaviour is closer to spec, or if this library could detect and fix it. Generally when using the rects lists you should assume that the rects could overlap and adapt your use case accordingly. |
When we select text 'Vestibulum neque massa, scelerisque sit amet ligula eu, congue molestie mi. Praesent ut
varius sem. Nullam at porttitor arcu, nec lacinia nisi. Ut ac dolor vitae odio interdum
condimentum.' from given sample pdf file then
let range = document.getSelection().getRangeAt(0);
RangeFix.getClientRects(range); returns the 3 rects in firefox and 4 rects in chrome browser.
Please find the attached document.
file-sample_150kB.pdf
The text was updated successfully, but these errors were encountered: