Skip to main content

TdxPDFDocument.FindText(string,TdxPDFDocumentTextSearchOptions) Method

Searches for a text string with the specified search settings.

Declaration

function FindText(const AText: string; const AOptions: TdxPDFDocumentTextSearchOptions): TdxPDFDocumentTextSearchResult; overload; virtual;

Parameters

Name Type Description
AText string

The searched text string.

AOptions TdxPDFDocumentTextSearchOptions

The required search settings.

Returns

Type Description
TdxPDFDocumentTextSearchResult

A text search operation result.

Remarks

Call the FindText function to find the nearest occurrence of a text string according to the specified search settings and the current search operation status.

Example

var
  ADocument: TdxPDFDocument;
  AMessage, AFileName: string;
  // ...
  if OpenDialog1.Execute then
    AFileName := OpenDialog1.FileName;
  ADocument := TdxPDFDocument.Create;
  ADocument.LoadFromFile(AFileName);
  // Checks if the tssFound flag is among the search result status flags
  if(ADocument.FindText('Dx',TdxPDFDocumentTextSearchOptions.Default).Status in [tssFound]) then
    AMessage := 'Found'
  else AMessage := 'Not found';
  ShowMessage(AMessage);
  ADocument.Free;

Refer to the following topic for additional information on the text search functionality: How to Search and Highlight Text in PDF Documents.

See Also