Skip to content

# PDFVisualContentLocator

Namespace: O2S.Components.PDF4NET.View.Content

Provides search services for content in a PDF document.

    public class PDFVisualContentLocator

Inheritance Object → PDFVisualContentLocator

## Constructors

### PDFVisualContentLocator(PDFDocumentView)

Initializes a new PDFVisualContentLocator object.

    public PDFVisualContentLocator(PDFDocumentView documentView)

Parameters

`documentView` PDFDocumentView
The PDFDocumentView that displays the results.

## Methods

### ClearTextSearchResults()

Clears the text search results and removes the highlights from the PDFDocumentView control.

    public void ClearTextSearchResults()

### HighlightNextTextSearchResult()

Highlights the next text search result.

    public bool HighlightNextTextSearchResult()

Returns

Boolean
True if the search result has been highlighted, false otherwise.

Remarks

This method has effect if the 'incrementalHighlight' parameter was true when the PDFVisualContentLocator.SearchText(String, PDFVisualSearchRange, PDFVisualTextSearchOptions, Boolean) has been called.

### HighlightNextTextSearchResult(Boolean)

Highlights the next text search result.

    public bool HighlightNextTextSearchResult(bool wrap)

Parameters

`wrap` Boolean
If true then when the next text search result reaches the end of the collection, it goes back to the beginning.

Returns

Boolean
True if the search result has been highlighted, false otherwise.

Remarks

This method has effect if the 'incrementalHighlight' parameter was true when the PDFVisualContentLocator.SearchText(String, PDFVisualSearchRange, PDFVisualTextSearchOptions, Boolean) has been called.

### HighlightPreviousTextSearchResult()

Highlights the previous text search result.

    public bool HighlightPreviousTextSearchResult()

Returns

Boolean
True if the search result has been highlighted, false otherwise.

Remarks

This method has effect if the 'incrementalHighlight' parameter was true when the PDFVisualContentLocator.SearchText(String, PDFVisualSearchRange, PDFVisualTextSearchOptions, Boolean) has been called.

### HighlightPreviousTextSearchResult(Boolean)

Highlights the previous text search result.

    public bool HighlightPreviousTextSearchResult(bool wrap)

Parameters

`wrap` Boolean
If true then when the previous text search result reaches the start of the collection, it goes back to the end.

Returns

Boolean
True if the search result has been highlighted, false otherwise.

Remarks

This method has effect if the 'incrementalHighlight' parameter was true when the PDFVisualContentLocator.SearchText(String, PDFVisualSearchRange, PDFVisualTextSearchOptions, Boolean) has been called.

### HighlightTextSearchResult(PDFVisualTextSearchResult)

Highlights the specified search result in the associated PDFDocumentView control.

    public bool HighlightTextSearchResult(PDFVisualTextSearchResult result)

Parameters

`result` PDFVisualTextSearchResult
Search result to highlight.

Returns

Boolean
True if the search result has been highlighted, false otherwise.

Remarks

If the search result is not visible, the content is scrolled so that the search result becomes visible.

### SearchText(String)

Searches the page content for the specified text.

    public PDFVisualTextSearchResultCollection SearchText(string text)

Parameters

`text` String
Text to find in page content.

Returns

PDFVisualTextSearchResultCollection
A collection of zero or more search results.

### SearchText(String, PDFVisualSearchRange, PDFVisualTextSearchOptions, Boolean)

Searches the page content for the specified text.

    public PDFVisualTextSearchResultCollection SearchText(string text, PDFVisualSearchRange searchRange, PDFVisualTextSearchOptions searchOptions, bool incrementalHighlight)

Parameters

`text` String
Text to find in page content.

`searchRange` PDFVisualSearchRange
The range for searching text

`searchOptions` PDFVisualTextSearchOptions
A set of options that specify how the text search should be performed.

`incrementalHighlight` Boolean
True if the search results should be highlighted one by one in the PDFDocumentView control, false if all search results are highlighted together.

Returns

PDFVisualTextSearchResultCollection
A collection of zero or more search results.