PDF.JS Express only search first ocurrence once and no more

Hi guys,

I’m using pdf.js-express 8.7.0. We use too much search and I founded out a behavior always I search.

When I search “energia” in my PDF opened with PDF.JS Express, it returns correct search and brought me first ocurrence.

After, somethimes I clear fieldtext and search again by “energia” in the same work, it doesn’t return the same result, doesn’t brought me first ocurrence. See image below:

image

Someone can help me?

Thanks too much

1 Like

Below, is the result of first search:

image

Hi ti11,

Thank you for contacting pdf.js express forums,

Does the search result show the same number of occurrence?
Does this issue happen for only a specific file? If so, can you share a file that reproduces the issue?

I was unable to reproduce on the demo site (8.7): PDF.js Viewer Demo | PDF.js Express
Do you have any custom code for the search functionality?

Thank you in advance.

Best regards,
Kevin Kim


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

Hi Kevin Kim,

No, when I test the search, all results is not the same. This problem ocurrs always my documents and there isn’t any custom search functionality.

I will include pdf example here. I cannot reproduce same problem with this link PDF.js Viewer Demo | PDF.js Express that you sent.

My version is the same, 8.7.0.

File example:
example.pdf (7.1 MB)

To reproduce this error, search by “equipamentos” (there is a ocurrence in first page). Immediately, erase last letter S and put again.

After this, no words in first page will be found.

Hi there,

Thank you for your response,

When I uploaded the document on our latest package (8.7) I was unable to reproduce the issue.
Video attached: 40760.mov
However there were some console errors from this pdf. Does this happen with any other pdf without issues?

Another option you could try is use redrawAnnotation right after the search event using a listener:
https://pdfjs.express/api/Core.AnnotationManager.html#redrawAnnotation__anchor
https://pdfjs.express/api/UI.html#.addSearchListener__anchor

Best regards,
Kevin Kim


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

Hi,

I record the error. See error in link below:

You need to type any letter.

1 Like

Hi there,

Thank you for the video,

I was able to reproduce it by removing the last letter before the search completes (spinning wheel). When the search was in progress, if you open the console there are the above mentioned warnings, and if we wait for it to complete, the search seems less to error out less.

We’ve added the issue to our backlog to be worked on in the future. We don’t have a timeline for when it will be fixed but if it does get fixed we’ll let you know when it’s available in an experimental build to test out and the estimated official release date. If you have a desired timeline for having this issue fixed please let us know and we’ll do our best to work with you on how this can fit into the release schedule.

Best regards,
Kevin Kim


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

Hi Kevin Kim,

We are a few days of a new release and we found this error.

If we cannot solve this error, we will abort and change pdf.js express. I posted here to try understand if this is a bug or just error.

Can you help us?

Hi there,

Thank you for your patience, this could be related to the warnings you saw on the console that occurred for some documents.

Could you please try this build https://pdftron.s3.amazonaws.com/custom/ID-zJWLuhTffd3c/WebViewer/PDFJSExpress-8.7.0-40760.zip and let me know if that solves your issues.

Best regards,
Kevin Kim


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

Hello Kim, thank you very much for your attention.

I believe the problem is not the alerts in the console. During the tests, I analyzed that when we wait for the search to complete and we redo the test by deleting the last letter, the error does not happen; that is, the error only occurs when the search is carried out when there is already a search in the process.

Hi there,

Were you able to try out the build above if that fixes the issue?

After the first load of the pdf, the first search seems to trigger console warnings. A temporary workaround would be to add a searchListener for when the search completes:
https://pdfjs.express/api/UI.html#.searchListener__anchor

Best regards,
Kevin Kim


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here