Get text selection from PDFTron WebViewer HTML5 Web Client

105 views
Skip to first unread message

Mirko

unread,
Aug 27, 2013, 7:54:57 AM8/27/13
to pdfne...@googlegroups.com
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 <canvas> element I would like to know if and how that is also possible with javascript.
Best regards

Matt Parizeau

unread,
Aug 27, 2013, 2:45:44 PM8/27/13
to pdfne...@googlegroups.com
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 http://www.pdftron.com/webviewer/demo/html5/doc/

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Mirko

unread,
Aug 28, 2013, 7:12:55 AM8/28/13
to pdfne...@googlegroups.com
Great, works like a charm.
Thanks a lot

Support

unread,
Aug 28, 2013, 12:15:51 PM8/28/13
to pdfne...@googlegroups.com
 
Although WebViewer is related to PDFNet, we try to keep the discussion in a separate forum to keep the noise down.
 
 
Reply all
Reply to author
Forward
Message has been deleted
0 new messages