PDFium Component Docs

FindFirst Método

Componente: TPdfView  ·  Unidade: PDFium
Inicia a busca do texto especificado. StartIndex é baseado em zero, -1 significa o fim da página. O parâmetro DirectionUp determina a direção desta operação de busca

Syntax

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

Return Value

O índice do primeiro caractere da primeira ocorrência, baseado em zero, ou -1 se o texto não for encontrado

Description

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.

Example

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;

See Also

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