Open SelvaSurukam opened 5 years ago
This is a known limitation. Because PDF.js uses absolute positioning, the chunks of text are sometimes merged. What can be done: the code which gets the text from the range can be improved to take the rectangle positions into the account https://github.com/agentcooper/react-pdf-highlighter/blob/master/src/components/PdfHighlighter.js#L485.
Hi thanks for quick reply.
When I tried to open PDF and copy text with Google Chrome Default PDf viewer, I am not getting this issue.
As you said earlier the problem in PDF.js, do you have some work around code samples to solve this or do you aware of how Google Chrome able to solve this.
Chrome's built-in viewer is not PDF.JS, they use a custom PDF renderer: https://opensource.google.com/projects/pdfium.
Hi once again thanks for quick reply.
Do you have any sample to fix this issue? Because you aware of this and you might have tried some approach to solve this.
If you have anything please share it, I can continue from there, because I have to fix this issue on priority now.
I don't have anything working, sorry. As I said earlier, I would start with exploring the distance between the rectangles.
Thanks, will implement and get back to you.
Did this problem get solved @SelvaSurukam ?
As a workaround, I get the values from window.getSelection()?.toString()
Hi @agentcooper.
If you see the sample deployed in https://agentcooper.github.io/react-pdf-highlighter/.
You have some predefined highlighted text. In that, one line highlighted as Impressive and highlighted text on right side panel is millions of lines of code atFacebookevery day
But actual content on pdf looks with space like millions of lines of code at Facebook every day.
So the problem is there should be space between at Facebook every day
So please help me in solving this.