Get text selection from PDFTron WebViewer HTML5 Web Client

Hi I am testing the WebViewer 1.5.0 (HTML5 version, no silverlight, no flash) client inside a website to display pdf files (after they have been converted to .xod format). Everything works fine. I would just like to ask if it is possible, from javascript, to get the text that the user selects inside the viewed pdf. I already have successfully made tests about getting via javascript the text selection of a normal text inside a web page, but since the contents of the pdf are displayed within a element I would like to know if and how that is also possible with javascript.
Best regards

Hi,

It is possible to get the selected text from JavaScript. Assuming that you have a reference to a WebViewer object you could use code something like: myWebViewer.getInstance().docViewer.GetSelectedText()
If you’re interested in learning about other capabilities of the HTML5 viewer you can browse through the API documentation at https://www.pdftron.com/api/web/global.html#WebViewer

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Great, works like a charm.
Thanks a lot
Il giorno martedì 27 agosto 2013 20:45:44 UTC+2, Matt Parizeau ha scritto:

Hi,

It is possible to get the selected text from JavaScript. Assuming that you have a reference to a WebViewer object you could use code something like: myWebViewer.getInstance().docViewer.GetSelectedText()
If you’re interested in learning about other capabilities of the HTML5 viewer you can browse through the API documentation at https://www.pdftron.com/api/web/global.html#WebViewer

Matt Parizeau
Software Developer
PDFTron Systems Inc.

On Tuesday, August 27, 2013 4:54:57 AM UTC-7, Mirko wrote:

Hi I am testing the WebViewer 1.5.0 (HTML5 version, no silverlight, no flash) client inside a website to display pdf files (after they have been converted to .xod format). Everything works fine. I would just like to ask if it is possible, from javascript, to get the text that the user selects inside the viewed pdf. I already have successfully made tests about getting via javascript the text selection of a normal text inside a web page, but since the contents of the pdf are displayed within a element I would like to know if and how that is also possible with javascript.
Best regards

Just FYI, the WebViewer Forum/KB is here: https://groups.google.com/forum/#!forum/pdfnet-webviewer
Although WebViewer is related to PDFNet, we try to keep the discussion in a separate forum to keep the noise down.