SearchText
Text, extraction
Description
Searches text blocks across the requested page range and copies hits into the caller-provided array while returning the total match count even when the array is smaller
The method reports page progress through OnProgress, honours Abort between pages and blocks, and restores the page that was selected before searching
Since v3.430.0 TPDFlibSearchOption also accepts soDiacriticInsensitive (1:1 Unicode fold so plain letters match accented Latin, Greek and Cyrillic counterparts), soWildcards (* and ? in the query, leftmost-longest, whole-word compatible) and soAcrossLines (phrases may span line and block breaks through a page-joined match)
Since v3.452.0 soCanonicalEquivalent matches canonically equivalent NFC and NFD text while preserving original hit coordinates, and soGraphemeClusters prevents matches and replacements from splitting surrogate pairs, combining sequences, emoji ZWJ sequences, flags or Indic conjuncts. When combined with soWildcards, one ? consumes one complete grapheme cluster
Hits additionally carry MatchStart and MatchLength positions inside the block text, plus ContextBefore and ContextAfter snippets when SearchContextChars is greater than zero
Use SearchTextEach when hits should be consumed immediately without choosing a result-array capacity
Syntax
Delphi
Function TPDFlib.SearchText(Const Query: WideString; Options: TPDFlibSearchOptions; Const PageRange: WideString; Var Hits: Array Of TPDFlibSearchHit): Integer;
Parameters
Please refer to the PDF Library for Delphi Developer Guide and header comments for detailed parameter descriptions.
Return Value
Please refer to the PDF Library for Delphi Developer Guide for specific return value semantics.
Remarks
For more related information, please refer to the relevant library documentation or demo projects.