Frameworks
Integrations
Mendix
SharePoint
Default UI
Modular UI
AnnotationManager
Annotation Types
Customize
Version 11
v11.0
Version 10
v10.12
v10.11
v10.10
v10.9
v10.8
v10.7
v10.6
v10.5
v10.4
v10.3
v10.2
v10.1
v10.0
Version 8
v8.12
v8.11
v8.10
v8.9
v8.8
v8.7
v8.6
v8.5
v8.4
v8.3
v8.2
v8.1
v8.0
Version 7
Version 6
v6.3
v6.2
v6.1
v6.0
Version 5
Version 4
Version 3
Version 2
WebViewer Server
WebViewer BIM
When users select text from a loaded document, this triggers an event that can be used to get the selected text. This is helpful in automatically creating annotations where the selected text is or perhaps extracting the text for creating free text annotations.
The main event of interest triggered by DocumentViewer when text is selected is the textSelected
event.
The textSelected
event gets fired whenever the selected text on the document changes. It is worth considering using debouncing if you are only looking to handle this event once the selection has stopped.
Also the textSelected
event fires once for each page with selected text. So if text is selected on page A and B, and the selected text on page A changed, the textSelected
event will fire once for each page even though there weren't any changes for page B.
You can also listen for the selectionComplete
event on the TextSelect
tool. This event does not return the selected text but we can still get the text from the DocumentViewer via getSelectedText
.
Get selected text by listening for a keydown or clipboard copy event.
You can read up more on text extractions in our other text extraction guides!
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales