Skip to main content
Version: Version 5

Interface: Search

Groups all the api actions related to search.

Properties

addEventListener()

addEventListener: (eventName, fn) => void

Add an event listener to the different events of search.

Parameters

eventName: "toggled" | "searchResultClicked" | "settingsClicked" | "caseSensitiveToggled" | "regularExpressionToggled" | "clearSearchPanelInputClicked"

fn: (active) => void | (searchResult) => void | () => void | (caseSensitive) => void | (regularExpression) => void | () => void

The callback to execute

Returns

void

Example

PdfToolsViewerApi.search.addEventListener('toggled', () => { console.log('callback') });


caseSensitiveToggled()

caseSensitiveToggled: (caseSensitive) => void

Trigger event indicating that the search case-sensitive ui element has been toggled.

Parameters

caseSensitive: boolean

Returns

void

Example

PdfToolsViewerApi.search.caseSensitiveToggled(false);


clearSearchPanelInputClicked()

clearSearchPanelInputClicked: () => void

Trigger event indicating that the search clear search panel input element has been clicked.

Returns

void

Example

PdfToolsViewerApi.search.clearSearchPanelInputClicked();


regularExpressionToggled()

regularExpressionToggled: (regularExpression) => void

Trigger event indicating that the search regular expression ui element has been toggled.

Parameters

regularExpression: boolean

Returns

void

Example

PdfToolsViewerApi.search.regularExpressionToggled(true);


removeEventListener()

removeEventListener: (eventName, fn) => void

Remove an event listener attached to an event of search.

Parameters

eventName: "toggled" | "searchResultClicked" | "settingsClicked" | "caseSensitiveToggled" | "regularExpressionToggled" | "clearSearchPanelInputClicked"

fn: (active) => void | (searchResult) => void | () => void | (caseSensitive) => void | (regularExpression) => void | () => void

The callback to execute

Returns

void

Example

PdfToolsViewerApi.search.removeEventListener('toggled') });


searchResultClicked()

searchResultClicked: (sr) => void

Trigger event indicating that a search result has been clicked.

Parameters

sr: any

The search result that was clicked.

Returns

void

Example

PdfToolsViewerApi.search.searchResultClicked(sr);


settingsClicked()

settingsClicked: () => void

Trigger event indicating that search settings have been clicked.

Returns

void

Example

PdfToolsViewerApi.search.settingsClicked();


toggled()

toggled: (active) => void

Trigger event indicating that the search has been toggled (opened or closed).

Parameters

active: boolean

True if it has been opened; false otherwise.

Returns

void

Example

PdfToolsViewerApi.search.toggled(true);