I MS Word this is easy to do,, I have searched and cannot find an easy way to do this or anyway to do this.
I thought maybe the app.execMenuItem might work but I don't know how to pass it to call the find function and pass it the value to search the text for and then highlight the selected text, for each name in the list.
Any ideas?
Thanks,
Aandi Inston
In v5, use
console.clear();
console.show();
app.listMenuItems();
to get all menu items with JavaScript (you can't pass any parameters).
I'm afraid I can't help you with the other questions.
Tobias
Any ideas on how to perform the highlight? In Acrobat 5 there is a highlight tool but you click on that and then select the text to highlight. I don't know how you would "select" text then apply the highlight to it unless it was a property of the text object that contained the text that was selected. I can't find anything on creating an object to contain the text or selection either.
Also, where can I get details on the execMenuItem and the options that are available for it.
I haven't worked with Acrobat in a long long time.
Thanks for all the help.
To determine the number of pages in the document, use this.numPages;
To determine the number of words on a given page, use the getPageNumWords() method.
You can find information about both of these functions in the Acrobat JavaScript guide. It might even contain information about the other things you're looking to do.
var thisPage = this.pageNum;
var numWords = this.getPageNumWords(thisPage);
for ( var j = 0; j < numWords; j++) {
nthWord = this.getPageNthWord(thisPage,j)
if ( nthWord == "mark" ) {
aQuadsFirst = this.getPageNthWordQuads(thisPage,j);
aQuadsLast = this.getPageNthWordQuads(thisPage,j+2);
annot = this.addAnnot({
page: thisPage,
type: "Highlight", // "Underline", "StrikeOut", or "Squiggly"
strokeColor: color.yellow,
quads: [[ aQuadsFirst[0][0], aQuadsFirst[0][1],
aQuadsLast[0][2], aQuadsLast[0][3],
aQuadsFirst[0][4], aQuadsFirst[0][5],
aQuadsLast[0][6], aQuadsLast[0][7]
]],
author: "A. C. Acrobat",
contents: "Highlight, Underline,\rStrikeOut, and Squiggly"
});
break;
}
}