Page 1 of 1

Selected Text - Value & Coordinates

Posted: Thu Nov 23, 2017 6:08 pm
by DolphinMann
I have used the search function for the forums and found many related topics, but nothing that seemed to answer or provide actual guidance on where to go for this....

How do I get the selected Text Value and Coordinates on a document?

Even using the DEMO app for instance. I can select text on the form and it properly highlights. I can then see the "Inst.ActiveDoc.ActiveSel" object has some properties that tell me a little about it, copy/paste etc. It also has a ClusterID and normal ID.

But I do not see any way to go from that selection to actual string values or X,Y,Width,Height coordinates. Though if I had the Value and starting X/Y I can calculate the text characters coordinates from the GetPageTextFunction.

In short :) I am just trying to figure out what a user is selecting within the application as it relates to the PageText

Re: Selected Text - Value & Coordinates

Posted: Thu Nov 23, 2017 8:07 pm
by DolphinMann
Update:

I have found that I can cast the selection as a TextSelection, if indeed it is, which I have confirmed it is: https://sdkhelp.pdf-xchange.com/vie ... tSelection

However I still cannot find any information on where or what the text is location.

Re: Selected Text - Value & Coordinates

Posted: Thu Nov 23, 2017 8:12 pm
by DolphinMann
Sorry for the thread spam. This was an immediate problem....

I think I found what I wanted in this thread: https://www.pdf-xchange.com/forum3 ... on#p116010

I needed to get the TextSelection and then get the PageTextSelection. From there it seems I can get the chars, including their indices which I can then of course map to the page.gettext stuff.

Re: Selected Text - Value & Coordinates

Posted: Fri Nov 24, 2017 12:41 pm
by Sasha - Tracker Dev Team
Hello DolphinMann,

Great that you have found that - from what I remember, there are several topics on this matter - I'm sure you can pretty much find what you need there.

Cheers,
Alex

Re: Selected Text - Value & Coordinates

Posted: Mon Dec 04, 2017 3:54 pm
by DolphinMann
Is there a way to get which Content Items are selected, instead of just text?

Re: Selected Text - Value & Coordinates

Posted: Tue Dec 05, 2017 8:35 am
by Sasha - Tracker Dev Team
Hello DolphinMann,

Of course, you will have to get an appropriate selection for this:
selection.contentItems
And get the https://sdkhelp.pdf-xchange.com/vi ... sSelection by this ID in the selChanged event.

Cheers,
Alex