interface PageTextSearchType {
    destroy: () => Promise<void>;
    findFirst: (
        text: string,
        flag: number,
        startPos: number,
    ) => Promise<boolean>;
    findNext: () => Promise<boolean>;
    findPrev: () => Promise<boolean>;
    getRectArray: () => Promise<null | FloatRectArrayType>;
    options: Options;
}

Implemented by

Properties

destroy: () => Promise<void>

Destroy the current object.

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

findFirst: (text: string, flag: number, startPos: number) => Promise<boolean>

Find the first match of the text.

Type declaration

let textPage = await page.getTextPage();
let pageTextSearch = await textPage.createPageTextSearch();
let bFind = await pageTextSearch.findFirst('search text', 0, 0);
findNext: () => Promise<boolean>

Find the next match of the text.

Type declaration

    • (): Promise<boolean>
    • Returns Promise<boolean>

      Return true if the text is found, otherwise return false.

let textPage = await page.getTextPage();
let pageTextSearch = await textPage.createPageTextSearch();
let bFind = await pageTextSearch.findFirst('search text', 0, 0);
while (bFind) {
let rectArrayItem = await pageTextSearch.getRectArray();
bFind = await pageTextSearch.findNext();
}
findPrev: () => Promise<boolean>

Find the previous match of the text.

Type declaration

    • (): Promise<boolean>
    • Returns Promise<boolean>

      Return true if the text is found, otherwise return false.

getRectArray: () => Promise<null | FloatRectArrayType>

Get the rect array of the text.

Type declaration

options: Options