SearchTextBatch

Text, extraction

Description

Searches multiple text queries while each requested page's text blocks are resident, avoiding one extraction pass per query

Matches are emitted in page, text-block and query-array order

Syntax

Function TPDFlib.SearchTextBatch(Const Queries: Array Of TPDFlibSearchQuery; Const PageRange: WideString; Var Hits: Array Of TPDFlibSearchBatchHit): Integer;

Parameters

QueriesQuery text and options for each zero-based query index; empty query text is ignored
PageRangeAn empty string for every page or a one-based page-range expression
HitsThe caller-provided result buffer

Return value

Returns the total number of query and text-block matches even when Hits is smaller than the result set

Performance

Each page is extracted once for the complete query array, case-insensitive text is folded once per block and hit geometry is calculated once for blocks matching one or more queries

Example

SetLength(Queries, 2);
Queries[0].Query := 'invoice';
Queries[0].Options := [soWholeWord];
Queries[1].Query := 'overdue';
Queries[1].Options := [];
SetLength(Hits, 128);
Total := PDF.SearchTextBatch(Queries, '', Hits);

See also

SearchTextBatchEach, TPDFlibSearchQuery, TPDFlibSearchBatchHit, SearchText