mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Re-factor PDFPrintServiceFactory
to use import maps
This is very old code, which can (ever so slightly) be simplified now that import maps are available.
This commit is contained in:
parent
60fd9d583d
commit
898172e9d2
6 changed files with 48 additions and 35 deletions
|
@ -20,7 +20,6 @@ import {
|
|||
shadow,
|
||||
} from "pdfjs-lib";
|
||||
import { getXfaHtmlForPrinting } from "./print_utils.js";
|
||||
import { PDFPrintServiceFactory } from "./app.js";
|
||||
|
||||
// Creates a placeholder with div and canvas with right size for the page.
|
||||
function composePage(
|
||||
|
@ -194,15 +193,16 @@ class FirefoxPrintService {
|
|||
}
|
||||
}
|
||||
|
||||
PDFPrintServiceFactory.instance = {
|
||||
get supportsPrinting() {
|
||||
/**
|
||||
* @implements {IPDFPrintServiceFactory}
|
||||
*/
|
||||
class PDFPrintServiceFactory {
|
||||
static get supportsPrinting() {
|
||||
const canvas = document.createElement("canvas");
|
||||
const value = "mozPrintCallback" in canvas;
|
||||
return shadow(this, "supportsPrinting", "mozPrintCallback" in canvas);
|
||||
}
|
||||
|
||||
return shadow(this, "supportsPrinting", value);
|
||||
},
|
||||
|
||||
createPrintService(
|
||||
static createPrintService(
|
||||
pdfDocument,
|
||||
pagesOverview,
|
||||
printContainer,
|
||||
|
@ -218,7 +218,7 @@ PDFPrintServiceFactory.instance = {
|
|||
optionalContentConfigPromise,
|
||||
printAnnotationStoragePromise
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export { FirefoxPrintService };
|
||||
export { PDFPrintServiceFactory };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue