Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
angel-langdon opened this issue Jan 31, 2022 · 8 comments
Open
2 tasks done
Labels
enhancement New feature or request fresh

Comments

@angel-langdon
Copy link

angel-langdon commented Jan 31, 2022

Before you start - checklist

  • I understand that React-PDF does not aim to be a fully-fledged PDF viewer and is only a tool to make one
  • 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:

@angel-langdon angel-langdon added the enhancement New feature or request label Jan 31, 2022
@github-actions

This comment was marked as outdated.

@github-actions github-actions bot added the stale label May 2, 2022
@angel-langdon
Copy link
Author

angel-langdon commented May 6, 2022

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 github-actions bot removed the stale label May 9, 2022
@github-actions

This comment was marked as outdated.

@github-actions github-actions bot added the stale label Aug 8, 2022
@github-actions

This comment was marked as outdated.

@wojtekmaj wojtekmaj reopened this Aug 26, 2022
@wojtekmaj wojtekmaj added fresh and removed stale labels Aug 26, 2022
@nicolasiscoding
Copy link

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

@ryankashi

This comment has been minimized.

@nmaddp1995
Copy link

@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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fresh
Projects
None yet
Development

No branches or pull requests

6 participants