From 97fe7d6a19cef06076cc8113c11d7f3ac9a3a0d7 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 15 Apr 2025 12:36:39 +0200 Subject: [PATCH] Add a "supportsPrinting" viewer-option (bug 1957401) This will allow us to respect the `print.enabled` Firefox preference, by extending [this method](https://searchfox.org/mozilla-central/rev/56117379696ea0cffb94cd09c14cd022a8c5e4e8/toolkit/components/pdfjs/content/PdfStreamConverter.sys.mjs#426-453), which will hide the toolbar and secondaryToolbar print-buttons. --- web/app.js | 7 ++++++- web/app_options.js | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/web/app.js b/web/app.js index 6a5941839..dfef5234a 100644 --- a/web/app.js +++ b/web/app.js @@ -875,7 +875,12 @@ const PDFViewerApplication = { }, get supportsPrinting() { - return PDFPrintServiceFactory.supportsPrinting; + return shadow( + this, + "supportsPrinting", + AppOptions.get("supportsPrinting") && + PDFPrintServiceFactory.supportsPrinting + ); }, get supportsFullscreen() { diff --git a/web/app_options.js b/web/app_options.js index c768603ed..133df8dae 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -136,6 +136,11 @@ const defaultOptions = { value: true, kind: OptionKind.BROWSER, }, + supportsPrinting: { + /** @type {boolean} */ + value: true, + kind: OptionKind.BROWSER, + }, toolbarDensity: { /** @type {number} */ value: 0, // 0 = "normal", 1 = "compact", 2 = "touch"