Functionality of getPageSearchResults() and merge document() methods not working properly

Product: PDFTron

Product Version: 8.10.0

In my scenario i am searching for text in pdf by using method of WebViewerInstance.UI.searchTextFull(text)
Search is working fine and results were highlighting. After that I am trying to get the results of search by using method Core.documentViewer.getPageSearchResults(); it’s not return me the proper results instead returning empty array.

Same code and functionality was working fine in 8.1.0 version now I am trying to upgrade it to 8.10.0 and the functionality is failing can you please help me regarding this

this.state.viewerInstance?.UI.searchTextFull(text, {
wholeWord : wholeWordFlag
});

this.state.viewerInstance?.Core.documentViewer.on(“searchInProgress”,
(in progress, isFullSearch) => {
if(!in progress && in progress !== undefined) {
const value: {
pageNum: number;
}[] = this.state.viewerInstance?.Core.documentViewer.getPageSearchResults();
}
}

The above code in 8.1.0 version it was returning me the all the results found accross all the pages in pdf after upgrading it to 8.10.0 it’s returning empty array . Can you please help me on this?

Hello,

From our initial investigation, it seems that the behavior may have changed due to some text search optimizations. Based on your code, it might be better wait for actual search results to change before attempting to get results. Perhaps, you could leverage the searchResultsChanged event.

Hello andy-huang,

Thank you for the response and I am able to achieve my functionality with your solution.