Component: TPdfView · Unit: PDFium
Appends unique matches for another query to the active page's search highlight overlay
Syntax
function AddSearchTextHighlight(const Text: WString; MatchCase: Boolean= False; MatchWholeWord: Boolean= False): Integer;
Description
The method scans the active page with the requested case and whole-word options, then appends every character range that is not already present in the highlight set
The return value is the number of unique ranges added by this call, or 0 when the view is inactive, the query is empty, no match exists, or every matching range is already highlighted
Remarks
- Available since v2.55.0
- Call HighlightSearchText first when the previous highlight set should be replaced
- Exact duplicate ranges are ignored so repeated or overlapping queries do not paint the same match twice
- Appending only duplicate ranges does not schedule a repaint, while new matches invalidate only their clipped device rectangles
- All accumulated ranges share HighlightColor and belong to the current page
- ClearHighlight or page navigation removes the complete set
Example
PdfView1.HighlightSearchText('invoice');
PdfView1.AddSearchTextHighlight('overdue');
PdfView1.AddSearchTextHighlight('total');
See Also