Mukesh Kumar
Mukesh Kumar

Reputation: 783

Add Javascript events to a pdf opened using pdfJS

I have a PDF file opened in a web page using PDFJS. now, I want to add JS event handlers,e.g. click, mouse hover etc, to all the text elements in the PDF. Since PDFJS open pdf using html5, is it possible to identify all text elements and add events to them?

Upvotes: 0

Views: 1442

Answers (1)

Roman Zhukov
Roman Zhukov

Reputation: 506

Built-in PDF.js viewer uses TextLayerBuilder for text search. That class adds to html page transparent layer with text elements. You can use it, for adding events for text. This page describes how to use TextLayerBuilder class.

Upvotes: 1

Related Questions