mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.36k stars 9.97k forks source link

Issue with Inaccurate Text Highlighting in PDF Search Using ng2-pdfjs-viewer - Version 13 #17007

Closed rajnish21a closed 1 year ago

rajnish21a commented 1 year ago

Configuration:

Issue Description: I am currently using ng2-pdfjs-viewer version 13 within my application, and overall, it has been working smoothly. However, I have encountered a specific issue when searching for text strings, such as "A10," within PDFs generated using the E3 series.

The problem is that while the search and highlighting functionality generally work correctly for "A10," it also highlights some additional, unintended instances, such as "A/10." This behavior is incorrect; it should only highlight "A10" and not variations like "A/10." I've noticed that similar issues occur when there is a space in between text in the PDF, causing the search to highlight unwanted portions of text.

It's worth noting that these issues are not present when using popular PDF readers like Adobe Acrobat. Upon further investigation, I realized that PDF.js, the PDF reader used by ng2-pdfjs-viewer, and other PDF readers interpret text layers differently, which appears to be the root cause of these inconsistencies.

I would greatly appreciate any assistance or guidance on how to address this issue, as it impacts the accuracy of text highlighting within PDFs generated by the E3 series. Unfortunately, I am unable to provide the PDF for reference, but I am eager to work towards a solution to improve the text highlighting accuracy.

Thank you for your understanding and support in resolving this matter.

Snuffleupagus commented 1 year ago

PDF.js version: latest

Please remember to always provide a version number, since "latest" is ambiguous.

I am currently using ng2-pdfjs-viewer version 13 within my application

Please note that that's a different project, and while it may use the PDF.js library we cannot provide help/support for that here.

Unfortunately, I am unable to provide the PDF for reference,

That unfortunately make this, or any other issue really, non-actionable since it's simply impossible for anyone the help without access to the PDF document in question.