SearchTextEach
Text and extraction
Description
Searches the selected document and emits each TPDFlibSearchHit immediately through OnHit, avoiding a caller-sized result buffer
The method reports page progress through OnProgress and checks the shared Abort state between pages and text blocks
Setting the callback Cancel parameter to True stops the search and sets the same abort state; call ResetAbort before starting another operation
Syntax
Delphi
Function TPDFlib.SearchTextEach(Const Query: WideString; Options: TPDFlibSearchOptions; Const PageRange: WideString; OnHit: TPDFlibSearchHitEvent): Integer;Parameters
| Query | Non-empty search text |
|---|---|
| Options | Any combination of soCaseSensitive and soWholeWord |
| PageRange | Page-range expression, or an empty string for every page |
| OnHit | Callback invoked once per matching text block; nil counts matches without materialising them |
Return values
Total hits emitted before completion or cancellation