Highlighted

How to select multi-line text

Explorer ,
Feb 13, 2020

Copy link to clipboard

Copied

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?

Topics

Acrobat SDK and JavaScript

Views

50

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to select multi-line text

Explorer ,
Feb 13, 2020

Copy link to clipboard

Copied

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?

Topics

Acrobat SDK and JavaScript

Views

51

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Mar 25, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
sorin.n LATEST
Explorer ,
Mar 31, 2020

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF
Add a group