Highlights in pdf

96 views
Skip to first unread message

Yamen Saleh

unread,
Sep 9, 2020, 2:06:01 PM9/9/20
to islandora-dev
Good day

Is there a way to highlight the search term inside the pdf in pdf.js?

Thanks

Seth Shaw

unread,
Sep 9, 2020, 4:48:33 PM9/9/20
to island...@googlegroups.com
There is... but no one has connected all the wires together yet.

PDF.js includes a "Find Controller" (https://github.com/mozilla/pdf.js/blob/82dede0458fdaf80961c328ee5ea1a5fef2f4aca/web/pdf_find_controller.js) with an "execute" function (https://github.com/mozilla/pdf.js/blob/82dede0458fdaf80961c328ee5ea1a5fef2f4aca/web/pdf_find_controller.js#L115) which allows you to execute a search programmatically. E.g.
pdfFindController.executeCommand('find', {
    caseSensitive: false, 
    findPrevious: undefined,
    highlightAll: true, 
    phraseSearch: true, 
    query: "myQuery"
});
The problem is that no one here (that I'm aware of) has taken the time to figure out how to take the search terms and run this bit of JS on the item's page. I'm sure many people will be very happy when someone does figure it out and shares it with the rest of us.

--
You received this message because you are subscribed to the Google Groups "islandora-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to islandora-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/islandora-dev/2d96b354-2919-48f1-bd91-0115c26e6c79n%40googlegroups.com.

david...@wwu.edu

unread,
Sep 9, 2020, 5:57:24 PM9/9/20
to islandora-dev
Here is one attempt at solving that problem for our Islandora 7 instance:

Yamen Saleh

unread,
Sep 10, 2020, 8:59:36 AM9/10/20
to islandora-dev
I can see it was implemented for Islandora 7 but not 8, why not add it as out of the box feature?
I think this is very good feature.

I will try to figure out how to do it, if I success i will share it.

Regards
Reply all
Reply to author
Forward
0 new messages