Skip to main content
Known Participant
January 13, 2017
Question

Get selected text content

  • January 13, 2017
  • 1 reply
  • 1094 views

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 has been closed for replies.

1 reply

Legend
January 13, 2017

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

2. PDTextSelectEnumText.

Legend
January 13, 2017

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