mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
[api-minor] Add an option to set the max canvas area
This commit is contained in:
parent
e0d934ac9d
commit
e9474f1c84
5 changed files with 35 additions and 3 deletions
10
web/app.js
10
web/app.js
|
@ -149,6 +149,10 @@ class DefaultExternalServices {
|
|||
static updateEditorStates(data) {
|
||||
throw new Error("Not implemented: updateEditorStates");
|
||||
}
|
||||
|
||||
static get canvasMaxAreaInBytes() {
|
||||
return shadow(this, "canvasMaxAreaInBytes", -1);
|
||||
}
|
||||
}
|
||||
|
||||
const PDFViewerApplication = {
|
||||
|
@ -945,7 +949,11 @@ const PDFViewerApplication = {
|
|||
}
|
||||
// Set the necessary API parameters, using all the available options.
|
||||
const apiParams = AppOptions.getAll(OptionKind.API);
|
||||
const params = { ...apiParams, ...args };
|
||||
const params = {
|
||||
canvasMaxAreaInBytes: this.externalServices.canvasMaxAreaInBytes,
|
||||
...apiParams,
|
||||
...args,
|
||||
};
|
||||
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) {
|
||||
params.docBaseUrl ||= document.URL.split("#")[0];
|
||||
|
|
|
@ -434,6 +434,11 @@ class FirefoxExternalServices extends DefaultExternalServices {
|
|||
const isInAutomation = FirefoxCom.requestSync("isInAutomation");
|
||||
return shadow(this, "isInAutomation", isInAutomation);
|
||||
}
|
||||
|
||||
static get canvasMaxAreaInBytes() {
|
||||
const maxArea = FirefoxCom.requestSync("getCanvasMaxArea");
|
||||
return shadow(this, "canvasMaxAreaInBytes", maxArea);
|
||||
}
|
||||
}
|
||||
PDFViewerApplication.externalServices = FirefoxExternalServices;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue