TextSearchOptions Class
Options that define PDF text search behavior.
Declaration
public class TextSearchOptions extends JavaObject
Remarks
The following code snippet searches for the word “keyword“ in a PDF document:
import java.nio.channels.*;
import java.nio.file.*;
public class Main {
public static void main(String[] args) throws Exception {
try (PdfDocument pdfDocument = new PdfDocument(FileChannel.open(
Path.of("document.pdf")))) {
TextSearchOptions options = new TextSearchOptions(
true, // Match case.
true // Match whole words.
);
// Search all pages in the document.
int pageCount = pdfDocument.getPages().size();
Iterable<TextSearchInfo> results = pdfDocument.findText(
"keyword",
options,
0,
pageCount - 1);
// Process search results.
for (TextSearchInfo result : results) {
}
// Save the document.
}
}
}
Inherited Members
com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)
Inheritance
Object
com.devexpress.system.JavaObject
TextSearchOptions
Constructors
TextSearchOptions() Constructor
Initializes a new instance of the TextSearchOptions class.
Declaration
public TextSearchOptions()
TextSearchOptions(boolean matchCase, boolean wholeWordOnly) Constructor
Initializes a new instance of the TextSearchOptions class with specified settings.
Declaration
public TextSearchOptions(boolean matchCase, boolean wholeWordOnly)
Parameters
| Name | Type | Description |
|---|---|---|
| matchCase | boolean | Specifies whether the search is case-sensitive. |
| wholeWordOnly | boolean | Specifies whether to match whole words only. |
TextSearchOptions(boolean matchCase) Constructor
Initializes a new instance of the TextSearchOptions class with specified settings.
Declaration
public TextSearchOptions(boolean matchCase)
Parameters
| Name | Type | Description |
|---|---|---|
| matchCase | boolean | Specifies whether the search is case-sensitive. |
Methods
getMatchCase() Method
Returns whether text search is case-sensitive.
Declaration
public boolean getMatchCase()
Returns
| Type | Description |
|---|---|
| boolean |
|
getWholeWordOnly() Method
Returns whether the search matches whole words only.
Declaration
public boolean getWholeWordOnly()
Returns
| Type | Description |
|---|---|
| boolean |
|