PDFium Delphi Component Docs

метод FindFirst

Компонент: TPdfView  ·  Модул: PDFium
Започва търсене на указания текст. StartIndex е с основа 0, -1 е за край на страницата. Параметърът DirectionUp определя посоката на тази операция по търсене.

Синтаксис

function FindFirst(const Text: WString; Options: TSearchOptions= []; StartIndex: Integer= 0; DirectionUp: Boolean= True): Integer;

Върната стойност

The 0-based character index of the first match, or -1 if the text is not found.

Описание

Initiates a text search on the current page. Call this method before using FindNext or FindPrevious to iterate through subsequent matches. Each call to FindFirst resets the internal search handle.

To highlight all occurrences visually without iterating, use HighlightSearchText instead.

Пример

var Pos: Integer;
begin
  Pos := PdfView.FindFirst('invoice', [soMatchCase]);
  while Pos >= 0 do
  begin
    Memo1.Lines.Add('Found at index: ' + IntToStr(Pos));
    Pos := PdfView.FindNext;
  end;
end;

Виж също

TPdfView.FindNext, TPdfView.FindPrevious, TPdfView.Find, TPdfView.HighlightSearchText