1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

[api-minor] Limit the maximum canvas width/height, in addition to its total area (bug 1943094)

Browsers not only limit the maximum total canvas area, but additionally also limit their maximum width/height which affects PDF documents with e.g. very tall and narrow pages.
To address this we add a new `maxCanvasDim` viewer-option, which in Firefox will use a browser preference, such that both the total canvas area and the width/height will affect when CSS-zooming is used.
This commit is contained in:
Jonas Jenwald 2025-03-04 11:30:54 +01:00
parent 5e6cfbe163
commit 9f9de4508c
6 changed files with 68 additions and 13 deletions

View file

@ -477,7 +477,8 @@ const PDFViewerApplication = {
)
: null;
const enableHWA = AppOptions.get("enableHWA");
const enableHWA = AppOptions.get("enableHWA"),
maxCanvasDim = AppOptions.get("maxCanvasDim");
const pdfViewer = new PDFViewer({
container,
viewer,
@ -506,6 +507,7 @@ const PDFViewerApplication = {
imageResourcesPath: AppOptions.get("imageResourcesPath"),
enablePrintAutoRotate: AppOptions.get("enablePrintAutoRotate"),
maxCanvasPixels: AppOptions.get("maxCanvasPixels"),
maxCanvasDim,
enableDetailCanvas: AppOptions.get("enableDetailCanvas"),
enablePermissions: AppOptions.get("enablePermissions"),
pageColors,
@ -527,6 +529,7 @@ const PDFViewerApplication = {
eventBus,
renderingQueue: pdfRenderingQueue,
linkService: pdfLinkService,
maxCanvasDim,
pageColors,
abortSignal,
enableHWA,