document 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!document
Thedocument object has the following methods:
open
Parameters
object
required
The configuration object.
Returns
Promise
required
A Promise.
download
Parameters
object
Optional configuration. If omitted, the original document filename is used and annotations are included.
Returns
Promise
required
A Promise.
getPages
Parameters
object
Optional configuration. If omitted, all pages are returned.
Returns
Promise<{ pages: PageInfo[]; }>
required
A Promise that resolves to page information.
getPageCount
Returns
Promise<{ pageCount: number; }>
required
A Promise that resolves to the page count.
close
Returns
Promise
required
A Promise.
Parameters
object
Optional configuration. If omitted, the whole document is printed.
Returns
Promise<PrintResult>
required
A Promise that resolves to the print result.
rotatePage
Parameters
object
required
The configuration object.
Returns
Promise
required
A Promise.
getText
Parameters
object
Optional configuration. If omitted, the whole document is used.
Returns
Promise<{ pageIndex: number; text: string; }[]>
required
A Promise that resolves to extracted text for each page.
export
Uint8Array format.
Parameters
object
Optional configuration. If omitted, the document will be exported with annotations.
Returns
Promise<Uint8Array>
required
A Promise that resolves to the exported PDF bytes.