What I want to do is, from JavaScript, highlight some text on the page similarly to what happens when the user manually selects some text or when Search finds a hit.
I've been poring over the Developer Guide, the API Reference, and the forum postings on this site and the only things I've found that have come close have been the wrong way around.
I've seen many postings asking how to extract the text that the user has selected, but I want to highlight the text that I programmatically define.
I don't want to use a Highlight Annotation for two reasons. First, this is temporary, my implementation of the equivalent of a Search function that really is not "search" but operates in the same way, with current, previous, and next hits. An annotation is a permanent change to the contents of the file. So conceptually it seems the wrong way around. Second, related, is that I want to be able to do this in Reader, and Reader will not let you add Annots to a file that does not have that enabled, and I cannot count on all files having that set ahead of time. Some might be legacy files created in Acrobat 5 where the property does not exist (and defaults now to "off") and some might be owned by a third party and could not be modified and redistributed.
Does this capability exist directly, perhaps by specifying the quads or the Nth Words for the start and end of the text to highlight?
Perhaps I could do it indirectly, by using the Search highlight. Can Search be initiated from JavaScript and be restricted to a single page, so I could specify to find the Nth instance of a search-word on the page and have that be highlighted?
I have not found anything to suggest I could do either of these approaches.
Any ideas?
Thanks,
August
doc.selectPageNthWord();
doc.getPageNthWord();
The Acrobat Search functionality can't be restricted to a single page.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script