Merge pull request #17667 from Snuffleupagus/createPrintService-params
Change `PDFPrintServiceFactory.createPrintService` to take a parameter object
This commit is contained in:
commit
fd5d040073
25
web/app.js
25
web/app.js
@ -1781,26 +1781,19 @@ const PDFViewerApplication = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pagesOverview = this.pdfViewer.getPagesOverview();
|
this.printService = PDFPrintServiceFactory.createPrintService({
|
||||||
const printContainer = this.appConfig.printContainer;
|
pdfDocument: this.pdfDocument,
|
||||||
const printResolution = AppOptions.get("printResolution");
|
pagesOverview: this.pdfViewer.getPagesOverview(),
|
||||||
const optionalContentConfigPromise =
|
printContainer: this.appConfig.printContainer,
|
||||||
this.pdfViewer.optionalContentConfigPromise;
|
printResolution: AppOptions.get("printResolution"),
|
||||||
|
optionalContentConfigPromise: this.pdfViewer.optionalContentConfigPromise,
|
||||||
const printService = PDFPrintServiceFactory.createPrintService(
|
printAnnotationStoragePromise: this._printAnnotationStoragePromise,
|
||||||
this.pdfDocument,
|
});
|
||||||
pagesOverview,
|
|
||||||
printContainer,
|
|
||||||
printResolution,
|
|
||||||
optionalContentConfigPromise,
|
|
||||||
this._printAnnotationStoragePromise
|
|
||||||
);
|
|
||||||
this.printService = printService;
|
|
||||||
this.forceRendering();
|
this.forceRendering();
|
||||||
// Disable the editor-indicator during printing (fixes bug 1790552).
|
// Disable the editor-indicator during printing (fixes bug 1790552).
|
||||||
this.setTitle();
|
this.setTitle();
|
||||||
|
|
||||||
printService.layout();
|
this.printService.layout();
|
||||||
|
|
||||||
if (this._hasAnnotationEditors) {
|
if (this._hasAnnotationEditors) {
|
||||||
this.externalServices.reportTelemetry({
|
this.externalServices.reportTelemetry({
|
||||||
|
@ -114,14 +114,14 @@ function composePage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FirefoxPrintService {
|
class FirefoxPrintService {
|
||||||
constructor(
|
constructor({
|
||||||
pdfDocument,
|
pdfDocument,
|
||||||
pagesOverview,
|
pagesOverview,
|
||||||
printContainer,
|
printContainer,
|
||||||
printResolution,
|
printResolution,
|
||||||
optionalContentConfigPromise = null,
|
optionalContentConfigPromise = null,
|
||||||
printAnnotationStoragePromise = null
|
printAnnotationStoragePromise = null,
|
||||||
) {
|
}) {
|
||||||
this.pdfDocument = pdfDocument;
|
this.pdfDocument = pdfDocument;
|
||||||
this.pagesOverview = pagesOverview;
|
this.pagesOverview = pagesOverview;
|
||||||
this.printContainer = printContainer;
|
this.printContainer = printContainer;
|
||||||
@ -202,22 +202,8 @@ class PDFPrintServiceFactory {
|
|||||||
return shadow(this, "supportsPrinting", "mozPrintCallback" in canvas);
|
return shadow(this, "supportsPrinting", "mozPrintCallback" in canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
static createPrintService(
|
static createPrintService(params) {
|
||||||
pdfDocument,
|
return new FirefoxPrintService(params);
|
||||||
pagesOverview,
|
|
||||||
printContainer,
|
|
||||||
printResolution,
|
|
||||||
optionalContentConfigPromise,
|
|
||||||
printAnnotationStoragePromise
|
|
||||||
) {
|
|
||||||
return new FirefoxPrintService(
|
|
||||||
pdfDocument,
|
|
||||||
pagesOverview,
|
|
||||||
printContainer,
|
|
||||||
printResolution,
|
|
||||||
optionalContentConfigPromise,
|
|
||||||
printAnnotationStoragePromise
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,14 +63,14 @@ function renderPage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PDFPrintService {
|
class PDFPrintService {
|
||||||
constructor(
|
constructor({
|
||||||
pdfDocument,
|
pdfDocument,
|
||||||
pagesOverview,
|
pagesOverview,
|
||||||
printContainer,
|
printContainer,
|
||||||
printResolution,
|
printResolution,
|
||||||
optionalContentConfigPromise = null,
|
optionalContentConfigPromise = null,
|
||||||
printAnnotationStoragePromise = null
|
printAnnotationStoragePromise = null,
|
||||||
) {
|
}) {
|
||||||
this.pdfDocument = pdfDocument;
|
this.pdfDocument = pdfDocument;
|
||||||
this.pagesOverview = pagesOverview;
|
this.pagesOverview = pagesOverview;
|
||||||
this.printContainer = printContainer;
|
this.printContainer = printContainer;
|
||||||
@ -367,26 +367,11 @@ class PDFPrintServiceFactory {
|
|||||||
return shadow(this, "supportsPrinting", true);
|
return shadow(this, "supportsPrinting", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static createPrintService(
|
static createPrintService(params) {
|
||||||
pdfDocument,
|
|
||||||
pagesOverview,
|
|
||||||
printContainer,
|
|
||||||
printResolution,
|
|
||||||
optionalContentConfigPromise,
|
|
||||||
printAnnotationStoragePromise
|
|
||||||
) {
|
|
||||||
if (activeService) {
|
if (activeService) {
|
||||||
throw new Error("The print service is created and active.");
|
throw new Error("The print service is created and active.");
|
||||||
}
|
}
|
||||||
activeService = new PDFPrintService(
|
return (activeService = new PDFPrintService(params));
|
||||||
pdfDocument,
|
|
||||||
pagesOverview,
|
|
||||||
printContainer,
|
|
||||||
printResolution,
|
|
||||||
optionalContentConfigPromise,
|
|
||||||
printAnnotationStoragePromise
|
|
||||||
);
|
|
||||||
return activeService;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user