Search and Index Essentials
Searching for Text in PDF Documents
11
T
ABLE
11.1
Search Properties
Property
Description
Determines how words will be matched
(phrase, all words, any words, boolean query)
wordMatching
T
ABLE
11.2
Search Methods
Method
Description
Adds an index to the list of searchable indexes
Searches the index list according to a specified path
Searches the document or index for specified text
Removes an index from the list of searchable indexes
addIndex
getIndexForPath
query
removeIndex
Finding Words in an PDF Document
The
search
object’s
query
method is used to search for text within a PDF document. It
accepts three parameters:
●
●
●
cQuery
: the text for which to search
cWhere
: where to search for the text:
–
ActiveDoc
: search within the active document
–
Folder
: search within a specified folder
–
Index
: search within a specified index
–
ActiveIndexes
: search within the active set of available indexes (the default)
cDIPath
: path to folder or index used in search
Performing a Simple Search of a Document
The simplest type of search is applied to the text within the PDF document. For example,
the following code performs a case-insensitive search for the word
Acrobat
within the
current document:
search.query("Acrobat");
Using Advanced Search Options
You can set the
search
object’s properties to use advanced searching options, which can
be used to determine how to match search strings, and whether to use proximity or
stemming.
To determine how the words in the search string will be matched, set the
search
object’s
wordMatching
property to one of the following values:
Acrobat JavaScript Scripting Guide
193