Skip to main content
Known Participant
Jan 13, 2017 12:02 PM UTC
Question

Get selected text content

Hello,

I created a plugin to add a custom menu which will get the selected text and then I can do the operation on that text.

AVDoc avDoc = AVAppGetActiveDoc();
// if a PDF is open, get its number of pages
PDDoc pdDoc = AVDocGetPDDoc(avDoc);

// Get the selected text as a text select

PDTextSelect pdtext =static_cast<PDTextSelect>(AVDocGetSelection(avDoc));

Now, I want to get the actual text content with this object. How can I achieve that?

Thanks

Best Regards,

Navnath

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Legend
Jan 13, 2017 12:28 PM UTC

1. Verify the selection type is Text or your code will surely crash Acrobat (when it isn't)

2. PDTextSelectEnumText.

Translate
Legend
Jan 13, 2017 12:30 PM UTC

And bear in mind, per the documentation, that the text passed to the callback may not be in reading order.

Translate