TextSearchInfo Class
Information about text search results on a PDF page.
Declaration
public class TextSearchInfo 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
TextSearchInfo
TextSearchInfo(int pageIndex, List<TextMatchInfo> matches, List<TextMatchGroup> groups)
Initializes a new instance of the TextSearchInfo class with specified settings.
Declaration
public TextSearchInfo(int pageIndex, List<TextMatchInfo> matches, List<TextMatchGroup> groups)
Parameters
| Name | Type | Description |
|---|---|---|
| pageIndex | int | The zero-based index of the page that contains search results. |
| matches | java.util.List<TextMatchInfo> | Individual text matches found on the page. |
| groups | java.util.List<TextMatchGroup> | Match groups found on the page. |
Methods
getGroups() Method
Returns match groups found on the page.
Declaration
public List<TextMatchGroup> getGroups()
Returns
| Type | Description |
|---|---|
| java.util.List<TextMatchGroup> | Match groups found on the page. |
getMatches() Method
Returns individual matches found on the page.
Declaration
public List<TextMatchInfo> getMatches()
Returns
| Type | Description |
|---|---|
| java.util.List<TextMatchInfo> | Individual matches found on the page. |
getPageIndex() Method
Returns the zero-based index of the page that contains search results.
Declaration
public int getPageIndex()
Returns
| Type | Description |
|---|---|
| int | The zero-based page index. |
getRectangles() Method
Returns rectangles that bound the matched text on the page.
Declaration
public Iterable<OrientedRectangle> getRectangles()
Returns
| Type | Description |
|---|---|
| java.lang.Iterable<OrientedRectangle> | Rectangles that bound the matched text. |