Nadeem Ahmad
Nadeem Ahmad

Reputation: 745

How to access the Text-Layer over the canvas in Pdftron

I am working on an application where I am using a third-party PDF viewer PDFtron. I can select the text over the canvas, but once I inspect it, I can't see the text overlay. Only the annotations are there. You can check the demo here.

If I can select the text on this, but it's not actually 'HTML' then how it's rendered on the canvas.

Simply, I am looking for the HTML overlay, which I can access through DOM APIs.

I am wondering if I can somehow enable it?

Upvotes: 1

Views: 421

Answers (1)

Wanbo
Wanbo

Reputation: 106

Texts are rendered on the canvas, so that's why when you inspect you can not see them.

If you want the texts added to the DOM, you can try turn on the Accessibility mode - https://www.pdftron.com/documentation/web/samples/advanced/#accessibility.

And you can also try extract the text - https://www.pdftron.com/documentation/web/guides/extraction/text-extract/. Or get the information on the selected text using events - https://www.pdftron.com/documentation/web/guides/extraction/selected-text/.

Upvotes: 2

Related Questions