Search results

Customize the text search color

26 Sep 2022 / 1 minute to read

The PDF Viewer library allows you to customize the color of the search text in the loaded PDF Document using the following properties of TextSearchColorSettings modules.

Step 1: Follow the steps provided in the link to create simple PDF Viewer sample.

Step 2: Add the following code snippet to customize the text search color.

Copied to clipboard
<button id="search">SearchText</button>
<button id="searchNext">SearchNext</button>
<button id="searchPervious">searchPervious</button>
<button id="searchCancel">CancelSearch</button>
Copied to clipboard
viewer.enableTextSearch = true;
// customize the textSeach color
viewer.textSearchColorSettings.searchColor = 'Blue';
viewer.textSearchColorSettings.searchHighlightColor ='Red';
document.getElementById('search').addEventListener('click', ()=> {
document.getElementById('searchNext').addEventListener('click', ()=> {
document.getElementById('searchPervious').addEventListener('click', ()=> {
document.getElementById('searchCancel').addEventListener('click', ()=> {

Find the Sample how to customize the text search color