TX Text Control .NET for Windows Forms

Find Method

Method|Introduced in 29.0
Namespace
TXTextControl.DocumentServer.PDF.Contents
Package
TXTextControl.TextControl.WinForms.SDK as TXDocumentServer.dll from the private NuGet feed or Text Control Offline Packages

Description

Performs a search in the DocumentServer.PDF.Contents.Lines.ContentLines list using a string value, a regular expression or by performing a search in a geometric location.

Syntax

Find(string)

Returns a list of DocumentServer.PDF.Contents.ContentLine found based on a string.

public List<ContentLine> Find(string text);
ParameterDescription
text

The string to search for in the document.

Find(string, RegexOptions)

Returns a list of DocumentServer.PDF.Contents.ContentLine objects found through a regular expression.

public List<ContentLine> Find(string regex, RegexOptions options);
ParameterDescription
regex

The regular expression that is used in the find process.

options

The regular expression options.

Find(PointF, float, bool)

Returns a list of DocumentServer.PDF.Contents.ContentLine objects at a geometric location with a given radius.

public List<ContentLine> Find(PointF position, float radius = 100f, bool partially = false);
ParameterDescription
position

The geometric location in the document to search for.

radius

The radius to define the search area.

partially

Specifies whether the lines have to be completely inside the given rectangle or just intersect with it.

Find(RectangleF, bool)

Returns a list of DocumentServer.PDF.Contents.ContentLine objects in a given rectangle.

public List<ContentLine> Find(RectangleF rectangle, bool partially = false);
ParameterDescription
rectangle

The rectangle that is used for the find process.

partially

Specifies whether the lines have to be completely inside the given rectangle or just intersect with it.

Return Value

Returns a list of DocumentServer.PDF.Contents.ContentLine objects that matches the find options.

Examples

The following example searches for text and handles the returned position.

var result = lines.Find("Quarterly report", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
Console.WriteLine($"Find result: {result}");