mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-12 21:21:04 +02:00
Merge pull request #21409 from Snuffleupagus/PDFViewer-#setPrintingAllowed
Add a `PDFViewer` helper method for setting `#printingAllowed` and dispatching the event
This commit is contained in:
commit
29ad297626
@ -720,6 +720,11 @@ class PDFViewer {
|
||||
});
|
||||
}
|
||||
|
||||
#setPrintingAllowed(isAllowed) {
|
||||
this.#printingAllowed = isAllowed;
|
||||
this.eventBus.dispatch("printingallowed", { source: this, isAllowed });
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently only *some* permissions are supported.
|
||||
* @returns {Object}
|
||||
@ -731,22 +736,14 @@ class PDFViewer {
|
||||
textLayerMode: this.#textLayerMode,
|
||||
};
|
||||
if (!permissions) {
|
||||
this.#printingAllowed = true;
|
||||
this.eventBus.dispatch("printingallowed", {
|
||||
source: this,
|
||||
isAllowed: this.#printingAllowed,
|
||||
});
|
||||
|
||||
this.#setPrintingAllowed(true);
|
||||
return params;
|
||||
}
|
||||
|
||||
this.#printingAllowed =
|
||||
this.#setPrintingAllowed(
|
||||
permissions.includes(PermissionFlag.PRINT_HIGH_QUALITY) ||
|
||||
permissions.includes(PermissionFlag.PRINT);
|
||||
this.eventBus.dispatch("printingallowed", {
|
||||
source: this,
|
||||
isAllowed: this.#printingAllowed,
|
||||
});
|
||||
permissions.includes(PermissionFlag.PRINT)
|
||||
);
|
||||
|
||||
if (
|
||||
!permissions.includes(PermissionFlag.COPY) &&
|
||||
@ -922,7 +919,6 @@ class PDFViewer {
|
||||
this.#annotationEditorUIManager = null;
|
||||
|
||||
this.#annotationEditorMode = AnnotationEditorType.NONE;
|
||||
|
||||
this.#printingAllowed = true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user