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

QueryNon-empty search text
OptionsAny combination of soCaseSensitive and soWholeWord
PageRangePage-range expression, or an empty string for every page
OnHitCallback invoked once per matching text block; nil counts matches without materialising them

Return values

Total hits emitted before completion or cancellation