* Search for text across all pages in the document. * * @param query - String or RegExp to search for * @param options - Search options (pages, case sensitivity, whole word) * @returns Array of matches with positions * * @example * ```typescript * // Search across all pages
(query: string | RegExp, options: FindTextOptions = {})
| 3127 | * ``` |
| 3128 | */ |
| 3129 | findText(query: string | RegExp, options: FindTextOptions = {}): TextMatch[] { |
| 3130 | const pages = this.getPages(); |
| 3131 | const pagesToSearch = options.pages ?? Array.from({ length: pages.length }, (_, i) => i); |
| 3132 | |
| 3133 | const results: TextMatch[] = []; |
| 3134 | |
| 3135 | for (const pageIndex of pagesToSearch) { |
| 3136 | if (pageIndex >= 0 && pageIndex < pages.length) { |
| 3137 | const matches = pages[pageIndex].findText(query, options); |
| 3138 | |
| 3139 | results.push(...matches); |
| 3140 | } |
| 3141 | } |
| 3142 | |
| 3143 | return results; |
| 3144 | } |
| 3145 | |
| 3146 | // ───────────────────────────────────────────────────────────────────────────── |
| 3147 | // Change tracking |
no test coverage detected