# 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:** 1

<div class="post-metadata">

**Author:** ![chitrang89](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@chitrang89](https://pdfjs.community/u/chitrang89)\
**Post date:** [June 19, 2020, 2:50am UTC](https://pdfjs.community/t/programmatically-highlight-text-upon-searching/71/1 "2020-06-19T02:50:31Z")

</div>

Hi Team,

We have implemented pdfjs express and are using the search function. We wish to extend our use case by being able to programmatically highlight text in the document once found. We have been trying to achieve this by searching the text first and then upon found text, consider using Highlight Annotations to achieve this. We have hit a road block given we need the X,Y positions of the highlight section and its width and height and all we have from search text callback is quads.

Can we please get some advice on how we can best achieve this?

Best,  
Chitrang

---

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