Selected Text - Value & Coordinates

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Selected Text - Value & Coordinates

Post 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
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: Selected Text - Value & Coordinates

Post 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.
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: Selected Text - Value & Coordinates

Post 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.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Selected Text - Value & Coordinates

Post 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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: Selected Text - Value & Coordinates

Post by DolphinMann »

Is there a way to get which Content Items are selected, instead of just text?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Selected Text - Value & Coordinates

Post 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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply