Read pdf.js search highlight for more information.
PDF.js can work as a part of a website or of a browser. Originally created as a Firefox extension, it is now included in Mozilla Firefox since 2012 (version 15) and is enabled by default since 2013 (version 19). It is also included in ownCloud, and as a browser extension for Google Chrome, Chromium, Firefox for Android, Pale Moon, and SeaMonkey.
I found a way to achieve PDF.js search highlight text. Find the co-ordinate of the point in the HTML page and then subtract the co-ordinate(position) of div.textLayer from it to find the co-ordinate of the text in the pdf displayed online.
In order to find the co-ordinate of the text in actual pdf find the aspect ratio and you would get the actual co-ordinate.
If the PDF displayed online is 800×900 and the text co-ordinate [(31,35),(40,35),(40,40),(31,40)] and the actual pdf size is 612×792 find the appropriate value of the area in actual pdf like this (612/(800 / 31)),(792/(900/35)) and do this way for all co-ordinate found in online, i.e, (40,35),(40,40),(31,40)