Please note: when loading a remote PDF then ensure that you have the correct CORS & CSP settings in place to provide the PDF.CORS (Cross-Origin Resource Sharing) and CSP (Content Security Policy) are both web security mechanisms.
CORS is about server-to-server communication from browsers
CSP is about what content your own webpage can load and execute
If a remote PDF fails to load in MuPDF WebViewer then it is very possible that this might be related to one of these security mechanisms - ensure to check your console logs for any errors!
Exports the PDF. Returns the PDF data in Uint8Array format.
Parameters
object
Optional configuration. If omitted, the document will be exported with annotations.
Show config properties
boolean
Default: true. Whether to include annotations.
Returns
Promise<Uint8Array>
required
A Promise that resolves to the exported PDF bytes.
Example
async function exportDoc() { webViewer.toast.show({ type: 'notification', content: 'Exporting ... please wait' }); webViewer.document.export({includeAnnotations:true}).then(exportSuccess, exportFailure)};async function exportSuccess(data) { webViewer.toast.show({ type: 'success', content: 'Exporting complete' }); // do what you need with the `data`}async function exportFailure(error) { webViewer.toast.show({ type: 'fail', content: 'Export error' }); console.error(`error: ${error}`);}exportDoc()