Untitled

 avatar
unknown
javascript
a year ago
506 B
5
Indexable
const handleSearch = (query) => {
    if (instance) {
      instance.search(query).then((results) => 
        const annotations = results.map((result) => {
          return new PSPDFKit.Annotations.HighlightAnnotation({
            pageIndex: result.pageIndex,
            rects: result.rectsOnPage,
            boundingBox: PSPDFKit.Geometry.Rect.union(result.rectsOnPage)
          });
        });
        annotations.forEach((annotation) => {
          instance.create(annotation);
        });
      });
Editor is loading...
Leave a Comment