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

search parameter viewer.html doesn't open automatically findbar with search string in text field #9831

Closed
van-nes opened this issue Jun 21, 2018 · 4 comments
Labels

Comments

@van-nes
Copy link

van-nes commented Jun 21, 2018

A pdf.js viewer.html call with (e.g.) search parameter:
www.dezijpe.nl/pdfjs/web/viewer.html?file=/zhb/pdf/2007030311.pdf#search=abc&phrase=true
works fine, BUT doesn't open automatically the findbar.

Only after using manually the magnifier icon (findbar.title), the findbar will be opened, however
with empty search field (missing the search string from: #search=abc).
Only the number of hits is correctly shown.

How exactly (implementation in viewer.js ?) to:

  1. automatically open findbar (PDFViewerApplication.findBar.open(); ?)
  2. automatically include the search text-string from param #serach =

Thanks for help.

@van-nes
Copy link
Author

van-nes commented Jun 24, 2018

#8185 gives me a hint:

  if (hash.indexOf('=') >= 0) {
    var params = (0, _ui_utils.parseQueryString)(hash);
    if ('search' in params) {
      var searchText = params['search'].replace(/"/g, '');
      if (searchText) {
        PDFViewerApplication.findBar.open();
        PDFViewerApplication.findBar.findField.value = searchText;
      }
     ...

It works!

Now looking for a params to search for full textstring and part of text string in order to search only for 'book' and not for' bookmaker'.

@erzaehlsalex
Copy link

@van-nes Did you create a PR for that? I think this is a really good feature!
@timvandermeij This is a really small feature that could be merged easily, right? :)

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Sep 28, 2018

This is essentially a duplicate of issue #8185, and should be closed as such.

This is a really small feature that could be merged easily, right? :)

Unfortunately not, since that completely ignores the Firefox integration; please refer to #8185 (comment) and the discussion in #3565.

@Snuffleupagus
Copy link
Collaborator

@timvandermeij Mind closing this one, since it's a duplicate of issue #8185?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants