DanielArnould / react-pdf-highlighter-extended

📄 Set of modern React components for PDF highlighting
https://danielarnould.github.io/react-pdf-highlighter-extended/example-app/
MIT License
43 stars 16 forks source link

Suggestion #3

Closed Elon-Mask12 closed 6 months ago

Elon-Mask12 commented 7 months ago

Absolutely love the project, loved the og library as well. Just wanna let u know of this one thing thats bothering me. The main reason why i chose react-pdf-highlighter for my projects over react-pdf or something is cause of this one bug . i believe its caused due the new version of some deps, but itd be nice if u could leave the deps in the old version, cause this is super annoying imo. Thanks. <3

DanielArnould commented 7 months ago

Thanks for the kind words.

Unfortunately, I was aware of this annoying bug. This issue is due to a long-standing bug in PDF.js that seems to be chromium-specific (https://github.com/mozilla/pdf.js/issues/9843). Fixes for it on the original react-pdf-highlighter encountered various platform-dependent issues (https://github.com/agentcooper/react-pdf-highlighter/issues/246#issuecomment-1670829314).

That said, trying to fix this bug is a priority for the next release of this fork (7.1.0). If I can't get anything working, I will probably revert to an earlier version of PDF.js where enhanceTextSelection was still available.

Elon-Mask12 commented 6 months ago

Hey, any updates? 👀 I was able to get it working by changing pdfjs-dist version to "2.16.105" and also the "DEFAULT_WORKER_SRC" to use the same version. and change import of PdfDocumentProxy to import type { PDFDocumentProxy } from "pdfjs-dist"; But by doing that, the highlights are no longer visible. : (

DanielArnould commented 6 months ago

I wasn't able to come up with a reasonable fix for this that didn't balloon the complexity of the project, so I've decided to rollback the PDF.js version.

The highlights not being visible was due to textLayer having its property textLayerDiv renamed to div between versions.

Updates are on the 7.1.0 branch which I hope to release shortly.

Elon-Mask12 commented 6 months ago

Holy shit! Thanks a fuckton. sharing this w. my friends <3<3