Web SDKv1.0.0

TextApi.search()

Every match, as SearchMatch[]. Needs the extract feature.
methodTextsince 1.0.0

Signature

search(query: string, options?: SearchOptions): Promise<SearchMatch[]>

Parameters

ParameterTypeDescription
querystringThe text to find. Must not be empty.
options?SearchOptionsmatchCase and matchWholeWord (both default to false), pages (zero-based; restrict the search) and limit (stop after N matches).

Returns

Promise<SearchMatch[]> Each { pageIndex, text, rects }.

Throws

  • INVALID_ARGUMENT — an empty query, or an index in pages out of range.
  • PAGE_ERROR — a page or its text could not be loaded.
  • DOCUMENT_CLOSED — the document has been closed.
  • FEATURE_NOT_LICENSED — the license lacks extract.

Example

TypeScript
const onCover = await doc.text.search('Total', { pages: [0], matchWholeWord: true });

More in TextApi