text object is an instance accessible from the main MuPDFWebViewer instance as follows:
This assumes you have returned your instance name as
webViewer from the initMuPDFWebViewer() promise!text
Thetext object has the following methods:
search
Parameters
object
required
The configuration object.
Returns
Promise<{ results: { words: { prefix: string; keyword: string; suffix: string; redMarked: boolean; rects: TRect[] }[], pageIndex: number }[] }
required
A Promise that resolves to search results grouped by page.
locateSource
Parameters
object
required
The configuration object.
Returns
Promise<{ pageIndex: number; words: [{ rects: TRect[] }] }>
required
A Promise that resolves to the matched word rects for highlighting.
getSelected
undefined.
Returns
Promise<{ text: string, pageIndex: number, rects: TRect[] } | undefined>
required
A Promise that resolves to the current selection, or
undefined if there is no selection.