Skip to main content
Boris56
Known Participant
February 13, 2020
Question

How to select multi-line text

  • February 13, 2020
  • 1 reply
  • 949 views

Hi,

I need to select text that is on several lines. I do not want to generate a PDTextSelect using the PDTextSelectCreateWordHilite method, as it turned out that the word numbers used in this method and the word numbers obtained using PDWordFinder are different. There is a PDDocCreateTextSelect method, which also allows you to generate a PDTextSelect. But there is one problem. I generate a PDTextSelect for one line:
PDTextSelect textSelection;
textSelection = PDDocCreateTextSelect (pdDoc, numPage, & fRect1);
AVDocSetSelection (avDoc, ASAtomFromString ("Text"), (void *) textSelection, true);
Then PDTextSelect for another line:
textSelection = PDDocCreateTextSelect (pdDoc, numPage, & fRect2);
AVDocSetSelection (avDoc, ASAtomFromString ("Text"), (void *) textSelection, true);
When the statement is executed
AVDocShowSelection (avDoc);
Only one line is selected.
Is there any way to solve this problem?

This topic has been closed for replies.

1 reply

Boris56
Boris56Author
Known Participant
March 25, 2020

I really need help. Perhaps there is another way, how to select multi-line text?

Boris56
Boris56Author
Known Participant
March 31, 2020

I have solved this problem. Perhaps this is useful to anyone.

When creating a PDTextSelect using the PDDocCreateTextSelect method, you can really select text on only one line. To select multi-line text, you must use the PDTextSelectCreateWordHiliteEx method. To ensure that the word numbers used in this method and the word numbers obtained using PDWordFinder do not differ, you must use the default settings for PDWordFinder.

Participating Frequently
April 25, 2023

Hi @Boris56 

I have text which can be multiple lines. I am also in the same boat, I can highlight a word but not multiple words. Do you have code which I can learn from to highlight multiple lines? Please advise, I am trying since a week on this. Thanks