Detailed description of issue
I have gone through the documentation and setup pdf.js with Vue. For searching a keyword and annotating it programmatically, I have referred the Advanced Search APIs and the sample given(here /documentation/search/advanced-search). The code is the same as the one given in the example. I am getting error when I call the function textSearchInit. Screenshot for reference: https://nimb.ws/A8ZVkR
Please guide me if something is missing or what went wrong here.
Expected behaviour
The keywords mentioned in the code must be searched and annotated as provided.
Does your issue happen with every document, or just one?
I have tried with the default document
When I use CoreControls.Search.Mode.PAGE_STOP instead of docViewer.SearchMode.e_page_stop(as in the code snippet given by me), I get the error as: https://nimb.ws/CmiS3a
I upgraded to the version 7.3.2 and the errors have gone. Now, when I call the function textSearchInit, the onResult callback doesn’t fire even though the search keyword is in the pdf. Below is the code example,
docViewer.on('documentLoaded', () => {
// Set search modes. See the API reference for more information
const searchMode = CoreControls.Search.Mode.PAGE_STOP | CoreControls.Search.Mode.HIGHLIGHT;;
console.log("doc loaded")
const searchOptions = {
fullSearch: true,
onResult: (result) => {
alert("result");
},
startPage: 2,
onDocumentEnd: function(){
alert("onDocumentEnd");
}
}
// start the search
const test= docViewer.textSearchInit('Edit', searchMode, searchOptions);
})
Actually the search was not working in that particular pdf due to some reasons. I changed the pdf and tried and the above code worked. Thanks a lot for checking.