How can I search a PDF document for a line of text, highlight it, and scroll to the highlighted text

时间:2019-04-08 13:03:19

标签: javascript reactjs pdf full-text-search

I am working on a project where i need to programmatically search for different phrases in a pdf document. I need to annotate these phrases with highlights, and then have a list of highlights which can be clicked, to make the application scroll to the highlighted text. The application is made in ReactJS.

We have been doing a lot of searching for a solution for this, but cannot find anyone who has done anything similar. We can find some libraries for displaying pdf's, and some for highlighting using the mouse.

with react-pdf we are able to search the text, but not make the highlights, with react-pdf-highlighter we are able to highlight text using the mouse, but we cant do it programmatically, because the hightlights are based on rectangle coordinates.

So what we need is a library which is able to extract rectangle coordinates for the text we are searching for. But we haven't been able to find a library with this ability yet.

Do anyone know of some software/libary which is able to do this. We are not limited to javascript if there exists a library in another language. But the end result need to be shown in a browser, and we need to be able to click the links to the highlighted text as described above.

0 个答案:

没有答案