Text search with many results crashes app in electron

WebViewer Version: 8.10.0

Do you have an issue with a specific file(s)?
Long files with many search results (i.e. more than ~50 000)

Can you reproduce using one of our samples or online demos?
Searching for ‘a’ on the large files demo in the file with 13 234 pages

Are you using the WebViewer server?
No

Does the issue only happen on certain browsers?
It crashes our electron app, in Chrome or other browsers it makes the page unresponsive.

Is your issue related to a front-end framework?
No, we are using Angular and the large files demo uses React as far as I know. It can be reproduced in both.

Is your issue related to annotations?
Yes, it seems so. Checking the ‘Performance’ tab of devtools, most of the time spent is in webviewer-core.min.js displayAdditionalSearchResults() which seems to be adding the annotations for the found texts.

Please give a brief summary of your issue:
Text search with many results crashes app

Please describe your issue and provide steps to reproduce it:
On the large files demo page (JS Large Files Viewer Demo | Apryse WebViewer) search for ‘a’ in the file with 13 234 pages. As there are many results the page will become unresponsive and the search field is not usable after some time.

Please provide a link to a minimal sample where the issue is reproducible:
See above.

Hi Apryse Team,

in our commercial electron application we use the Webviewer javascript library for PDF manuals, and searching the documents can get unresponsive, if it finds many results. Doing the same search over again (with clearing the previous results) will end up crashing the process in electron after some tries.

I.e. on the large files demo page, I can see the same, the page becomes unresponsive. Cancelling the search becomes not that easy, as the search box takes 10-30 seconds to recognize the click.

Checking the issue it seems webviewer is stuck in annotating the PDF file, which with such many results might be fine, but making the page unresponsive is a problem for us. Based on my tests webviewer did not crash in Chrome.

The search in our application is just simply starting it from an input like:

  public search(searchText: string): void {
    this.webViewerInstance.UI.searchTextFull(searchText, this.searchOptions);
  }
// searchOptions above is:
// {
//    caseSensitive: false,
//    wholeWord: false,
//    wildcard: false,
//    regex: false,
//    searchUp: false,
//    ambientString: false,
//  }

Then handling the results returned in the corresponding events, showing them in a :

  public handleSearchEvents(): void {
    this.documentViewer.addEventListener('searchResultsChanged', (results) => {
      this.searchResults = results;
    });
    this.documentViewer.addEventListener('searchInProgress', (inProgress) => {
      this.searchInProgress = inProgress;
    });
  }

Is this a known limitation / bug which will be fixed in a future release? Could you please help us solving this issue?

Hi Balázs,

Can you please provide the file that has this issue so we can look into it further?

Best Regards,
Ahmad Moaaz
Software Developer
Apryse

Sadly it turns out that pdf cannot be shared here on the community forum, but I’ve create a support ticket, where we might get to the bottom of this.

I’ll come back here and update this post with our findings later on.