react-pdf
react-pdf copied to clipboard
Implement native PDF search functionality using `pdf.js` capabilities
Before you start - checklist
- [X] I understand that React-PDF does not aim to be a fully-fledged PDF viewer and is only a tool to make one
- [X] I have checked if this feature request is not already reported
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
- Implement from zero using only
pdf.js
Additional information
Related Stackoverflow posts:
- https://stackoverflow.com/questions/35501417/how-to-search-with-pdf-js
- https://stackoverflow.com/questions/70923975/how-to-use-pdffindcontroller-pdf-js-inside-react-pdf
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.
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
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.
This issue was closed because it has been stalled for 14 days with no activity.
@angel-langdon do you have an example of this?
^
@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!