# Programmatically highlight text upon searching

**URL:** <https://pdfjs.community/t/programmatically-highlight-text-upon-searching/71>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [June 19, 2020, 2:50am UTC](https://pdfjs.community/t/programmatically-highlight-text-upon-searching/71 "2020-06-19T02:50:31Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![zzhang](https://avatars.discourse-cdn.com/v4/letter/z/b9e5f3/32.png) [@zzhang](https://pdfjs.community/u/zzhang)\
**Post date:** [June 19, 2020, 2:55pm UTC](https://pdfjs.community/t/programmatically-highlight-text-upon-searching/71/2 "2020-06-19T14:55:40Z")

</div>

Hi Chitrang,

Thanks for contacting us regarding PDFJS Express!

Fortunately, the information that quads contain is good enough to programmatically create a highlight annotation.

We have a **text-position** sample that shows the code you might be interested in. The sample is available under the **samples/advanced/text-position** folder in the download package from [https://pdfjs.express/documentation/get-started/manually](https://pdfjs.express/documentation/get-started/manually).

The function in the sample that you want to take a look at is **highlightText**.

Let me know how this works and if you have any other questions!

Best Regards,  
Zhijie

---

_[View the full topic](https://pdfjs.community/t/programmatically-highlight-text-upon-searching/71)._
