@@ -720,6 +720,11 @@ class PDFViewer {
720720 } ) ;
721721 }
722722
723+ #setPrintingAllowed( isAllowed ) {
724+ this . #printingAllowed = isAllowed ;
725+ this . eventBus . dispatch ( "printingallowed" , { source : this , isAllowed } ) ;
726+ }
727+
723728 /**
724729 * Currently only *some* permissions are supported.
725730 * @returns {Object }
@@ -731,22 +736,14 @@ class PDFViewer {
731736 textLayerMode : this . #textLayerMode,
732737 } ;
733738 if ( ! permissions ) {
734- this . #printingAllowed = true ;
735- this . eventBus . dispatch ( "printingallowed" , {
736- source : this ,
737- isAllowed : this . #printingAllowed,
738- } ) ;
739-
739+ this . #setPrintingAllowed( true ) ;
740740 return params ;
741741 }
742742
743- this . #printingAllowed =
743+ this . #setPrintingAllowed (
744744 permissions . includes ( PermissionFlag . PRINT_HIGH_QUALITY ) ||
745- permissions . includes ( PermissionFlag . PRINT ) ;
746- this . eventBus . dispatch ( "printingallowed" , {
747- source : this ,
748- isAllowed : this . #printingAllowed,
749- } ) ;
745+ permissions . includes ( PermissionFlag . PRINT )
746+ ) ;
750747
751748 if (
752749 ! permissions . includes ( PermissionFlag . COPY ) &&
@@ -922,7 +919,6 @@ class PDFViewer {
922919 this . #annotationEditorUIManager = null ;
923920
924921 this . #annotationEditorMode = AnnotationEditorType . NONE ;
925-
926922 this . #printingAllowed = true ;
927923 }
928924
0 commit comments