Reduce PDF.js maxCanvasPixels in Safari (#23781)

GitOrigin-RevId: 3b75d85bb4af33e4d4d40ee6f1dc9cf375f1435f
This commit is contained in:
Alf Eaton
2025-02-25 09:23:52 +00:00
committed by Copybot
parent 7070a0d410
commit 02cd5d2f2f

View File

@@ -8,6 +8,7 @@ import {
LinkTarget,
} from 'pdfjs-dist/web/pdf_viewer.mjs'
import 'pdfjs-dist/web/pdf_viewer.css'
import browser from '@/features/source-editor/extensions/browser'
const DEFAULT_RANGE_CHUNK_SIZE = 128 * 1024 // 128K chunks
@@ -36,7 +37,7 @@ export default class PDFJSWrapper {
eventBus: this.eventBus,
imageResourcesPath,
linkService: this.linkService,
maxCanvasPixels: 8192 * 8192, // default is 4096 * 4096, increased for better resolution at high zoom levels
maxCanvasPixels: browser.safari ? 4096 * 4096 : 8192 * 8192, // default is 4096 * 4096, increased for better resolution at high zoom levels (but not in Safari, which struggles with large canvases)
annotationMode: PDFJS.AnnotationMode.ENABLE, // enable annotations but not forms
annotationEditorMode: PDFJS.AnnotationEditorType.DISABLE, // disable annotation editing
})