document
object is an instance accessible from the main mupdfwv.MuPDFWebViewer instance as follows:
mupdf
from the initMuPDFWebViewer() promise!document
object has the following methods:
open(config: { url: string, filename: string })
Opens a PDF document.
Promise
.
close()
Closes the currently opened PDF document.
Promise
.download(config?: { fileName?: string, includeAnnotations?: boolean })
Downloads the PDF file.
true
. Whether to include annotations.Promise
.export(config?: { includeAnnotations?: boolean })
Exports the PDF. Returns the PDF data in Uint8Array
format.
true
. Whether to include annotations.Promise<Uint8Array<ArrayBufferLike>>
.getPages(config?: { pageRange?: string })
Gets PDF page information.
Promise<{ pages: mupdfwv.PageInfo[]; }>
.getPageCount()
Gets the total number of pages in the PDF.
Promise<{ pageCount: number; }
.print(config?: { pageRange: string })
Prints the PDF.
Promise<mupdfwv.PrintResult>
.rotatePage(config: { pageRange: string, degree: mupdf.refs.degree })
Rotates pages.
Promise
.getText(config?: { pageRange?: string })
Extracts text from the PDF.
Promise<{ pageIndex: number; text: string; }[]>
.