wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.
https://projects.wojtekmaj.pl/react-pdf
MIT License
8.97k stars 861 forks source link

Implement native PDF search functionality using `pdf.js` capabilities #938

Open angel-langdon opened 2 years ago

angel-langdon commented 2 years ago

Before you start - checklist

Description

pdf.js has native functionality to search inside the PDF using PDFFindController.

It would be nice for react-pdf to have an interface to access these native pdf.js useful methods

Proposed solution

I suggest adding necessary props for Document component that enables a way to search the PDF using pdf.js capabilities

Alternatives

Additional information

Related Stackoverflow posts:

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

angel-langdon commented 2 years ago

I managed to solve this using pdf.js API, react-virtualized and some math/programming to transform coordinates into CSS/JS valid values

You can do it without using react-virtualized but is much faster with it

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 14 days with no activity.

nicolasiscoding commented 1 year ago

@angel-langdon do you have an example of this?

ryankashi commented 9 months ago

^

nmaddp1995 commented 8 months ago

@angel-langdon Hi, I'm facing the same issue as you, if I implement the search function with the current react-pdf, it will cause a lot of effort to draw highlight and jump, ... So could you share with us how could you deal with that problem with pdfjs and react-virtualized. Thanks in advanced!

Kashi-Datum commented 1 week ago

Any updates on this? Being able to Ctrl+F a block of text on a pdf is an extremely important feature, and it is too buggy/glitchy in its current state because the search functionality is not quite there yet with react-pdf.