PDF.js实现搜索多个不同的关键词高亮显示效果

static\PDF\web\viewer.js

392行左右

// 自定义搜索关键词----------------------------------------
this.searchKeywords = keyword => {
  if (typeof PDFViewerApplication !== 'undefined') {
    PDFViewerApplication.eventBus.dispatch('find', {
      query: keyword,
      caseSensitive: false,
      highlightAll: true,
      findPrevious: true
    });
  }
}

static\PDF\web\viewer.js

1261行左右 

// 高亮显示N个关键词----------------------------------------
var keywords = new URL(decodeURIComponent(location)).searchParams.get('keywords');//获取关键词数组
if (keywords && keywords !== 'undefi

猜你喜欢

转载自blog.csdn.net/qq_37860634/article/details/135395491