1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-29 15:47:57 +02:00

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.
This commit is contained in:
Jonas Jenwald 2025-04-15 12:36:39 +02:00
parent 2f7d163dfd
commit 97fe7d6a19
2 changed files with 11 additions and 1 deletions

View file

@ -875,7 +875,12 @@ const PDFViewerApplication = {
}, },
get supportsPrinting() { get supportsPrinting() {
return PDFPrintServiceFactory.supportsPrinting; return shadow(
this,
"supportsPrinting",
AppOptions.get("supportsPrinting") &&
PDFPrintServiceFactory.supportsPrinting
);
}, },
get supportsFullscreen() { get supportsFullscreen() {

View file

@ -136,6 +136,11 @@ const defaultOptions = {
value: true, value: true,
kind: OptionKind.BROWSER, kind: OptionKind.BROWSER,
}, },
supportsPrinting: {
/** @type {boolean} */
value: true,
kind: OptionKind.BROWSER,
},
toolbarDensity: { toolbarDensity: {
/** @type {number} */ /** @type {number} */
value: 0, // 0 = "normal", 1 = "compact", 2 = "touch" value: 0, // 0 = "normal", 1 = "compact", 2 = "touch"