# Search results text highlighting only

**URL:** https://pdfjs.community/t/search-results-text-highlighting-only/2002
**Category:** Technical Support
**Created:** [September 2, 2022, 4:00pm UTC](https://pdfjs.community/t/search-results-text-highlighting-only/2002 "2022-09-02T16:00:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![apetrov](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@apetrov](https://pdfjs.community/u/apetrov)
#### Post date: [September 2, 2022, 4:00pm UTC](https://pdfjs.community/t/search-results-text-highlighting-only/2002/1 "2022-09-02T16:00:56Z")

</div>

**[Pdfjs.express](http://Pdfjs.express) Viewer version**

**Issue description**  
We trying to highlight search results in viewer using `textSearchInit` method:

```javascript
const searchMode = instance.Core.Search.Mode.PAGE_STOP | instance.Core.Search.Mode.HIGHLIGHT;
documentViewer.textSearchInit(phrase, searchMode, {fullSearch: true});

```

And unfortunately we did not saw expected behavior.

We also tried to highlight search results in viewer using `searchTextFull`:

```javascript
instance.UI.searchTextFull("some")

```

And it’s working as expected, but it also displays search sidebar, which we would like to hide and make our own instead.

**The question**

Is this possible to highlight text in viewer only, without displaying search sidebar?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)
#### Post date: [September 2, 2022, 4:01pm UTC](https://pdfjs.community/t/search-results-text-highlighting-only/2002/3 "2022-09-02T16:01:01Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:
- [Searching in PDF.js Express - Get started](https://pdfjs.express/documentation/search/overview#get-started)
- [Basic searching - Changing highlight colors](https://pdfjs.express/documentation/search/basic-search.8#changing-highlight-colors)
- [Remove annotations in viewer - Programmatically](https://pdfjs.express/documentation/annotation/remove-annotations#programmatically)

APIs:
- [Core.Annotations.TextHighlightAnnotation - new TextHighlightAnnotation( [initializer])](https://pdfjs.express/api/Core.Annotations.TextHighlightAnnotation.html#TextHighlightAnnotation__anchor)
- [Tools.RedactionCreateTool - setEnableTextAutoSize(enable)](https://pdfjs.express/api/7.0/Tools.RedactionCreateTool.html#setEnableTextAutoSize__anchor)
- [TextHighlightAnnotation - new TextHighlightAnnotation()](https://pdfjs.express/api/TextHighlightAnnotation.html#TextHighlightAnnotation__anchor)

Forums:
- [Search result not highlighting some results](https://pdfjs.community/t/search-result-not-highlighting-some-results/1034/1)
- [Programmatically highlight area on pdf using coordinates or quads](https://pdfjs.community/t/programmatically-highlight-area-on-pdf-using-coordinates-or-quads/847/1)
- [Highlight tool trigger as left click](https://pdfjs.community/t/highlight-tool-trigger-as-left-click/1664/1)

  
  

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)

---

<div class="post-metadata">

### Author: ![zserviss](https://avatars.discourse-cdn.com/v4/letter/z/a9a28c/32.png) [@zserviss](https://pdfjs.community/u/zserviss)
#### Post date: [September 2, 2022, 5:17pm UTC](https://pdfjs.community/t/search-results-text-highlighting-only/2002/4 "2022-09-02T17:17:46Z")

</div>

Hi Apetrov,

The work around for this issue would be to just hide the panel as soon as the search is performed.

e.g.

```javascript
instance.UI.searchTextFull('some')
instance.UI.closeElements(['searchPanel']);

```

Hopefully this works for you.

Best Regards,  
Zach Serviss  
Web Development Support Engineer  
PDFTron Systems, Inc.

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)
