【问题标题】:Use solid color for highlighted words in pdf.js在 pdf.js 中为突出显示的单词使用纯色
【发布时间】:2015-11-27 13:50:21
【问题描述】:

我想改变 pdf.js 使用的高亮颜色

https://mozilla.github.io/pdf.js/web/viewer.html

按 Ctrl + F 并在文档中查找任何单词 any

我可以通过更改 pdf js 样式文件中的颜色来做到这一点。

.textLayer .highlight.selected {
    background-color: rgb(0, 100, 0);
}

我希望这种颜色不透明。如果您看到突出显示的单词是透明的。

我知道让它透明的原因是底层的 pdf 内容是可见的。 Pdf.js 只是在原始 pdf 内容上呈现透明文本。它使用此透明文本进行搜索和突出显示。

无论如何我可以用纯色突出显示单词吗?

【问题讨论】:

    标签: css pdf.js


    【解决方案1】:

    在 viewer.css 的 textLayer 类中,您可以更改不透明度。为使其稳定,您可以移除不透明度或设置为 1,但您将无法看到文本。我觉得 0.4 看起来不错

    .textLayer {
         position: absolute;
         left: 0;
         top: 0;
         right: 0;
         bottom: 0;
         overflow: hidden;
         opacity: 1; /* 0.4 looks nice, but 1 answers your question */
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-11
      • 1970-01-01
      • 1970-01-01
      • 2014-08-07
      • 2012-11-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多