Skip to main content
The capture object is an instance accessible from the main mupdfwv.MuPDFWebViewer instance as follows:
const capture = mupdf.capture;
This assumes you have returned your instance name as mupdf from the initMuPDFWebViewer() promise!

capture

The capture object has the following methods:

selectAndExport

selectAndExport() Once this method is called it allows the user to select a region which is then exported as an image and returned as a promise with the image data.
  • Returns: Promise<{ imageBytes: Uint8Array }>.
Captured images do not include viewer-only overlays such as those created with viewer.highlight(). To include highlighted regions in output, create real PDF annotations with annotation.add() first.
Example
mupdf.capture.selectAndExport().then(captureSuccess, captureFailure)

function captureSuccess(data) {
    console.log(`Capture data is: ${data.imageBytes}`);
}

function captureFailure(error) {
    console.error(`Capture error: ${error}`);
}
I