SearchContextChars

Text and extraction

Description

SearchContextChars controls how many characters of surrounding block text SearchText, SearchTextEach, SearchTextBatch and the stateful BeginTextSearch / NextTextSearchHit pair capture around each match

When 0 (the default) or negative, the ContextBefore and ContextAfter fields on every returned TPDFlibSearchHit stay empty

When positive, each hit's ContextBefore holds up to SearchContextChars characters immediately preceding the match inside MatchText, and ContextAfter holds up to SearchContextChars characters immediately following it. Both are clamped to the available block text, so a match near the start or end of the block yields a shorter context string

Syntax

Delphi

Property TPDFlib.SearchContextChars: Integer Read FSearchContextChars Write FSearchContextChars;

Remarks

Set this property before calling a search method; it is read once per match while building each hit. Changing it does not affect hits already returned by an earlier call

See also

TPDFlibSearchHit, SearchText, SearchTextEach, SearchTextBatch, BeginTextSearch