WebViewer Version: 8.9.0
Please give a brief summary of your issue:
Highlighting multiple Seaches’ Results
Please describe your issue and provide steps to reproduce it:
Hello there,
I’m using WebViewer in a Vue.js app. I’m trying to highlight multiple searches’ results, but the viewer can only hightlight the results of the last search. Is there a way or an API I’m missing to solve my problem? Thank you!
Please provide a link to a minimal sample where the issue is reproducible:
let annotsToAdd = []
documentViewer.addEventListener('documentLoaded', () => {
const mode = Search.Mode.PAGE_STOP | Search.Mode.HIGHLIGHT;
const options = {
fullSearch: true,
onResult(result) {
// console.log(result)
if (result.resultCode === Search.ResultCode.FOUND) {
const textQuad = result.quads[0].getPoints();
const annot = new Annotations.TextHighlightAnnotation({
PageNumber: result.pageNum,
Quads: [textQuad],
})
annotsToAdd.push(annot);
annotationManager.addAnnotation(annot);
annotationManager.redrawAnnotation(annot);
}
}
}
documentViewer.textSearchInit('PDF', mode, options);
console.log(annotsToAdd);
documentViewer.textSearchInit('高亮', mode, options)
console.log(annotsToAdd);
annotationManager.drawAnnotationsFromList(annotsToAdd);
});
I thought using a list and redraw the highlight annotation at last would help. It turns out this is exactly the same as redraw on every results. Both of them display the last search’s result.