1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

[api-minor] Add a getDocument option to disable ImageDecoder usage

This allows end-users to forcibly disable `ImageDecoder` usage, even if the browser appears to support it (similar to the pre-existing option for `OffscreenCanvas`).
This commit is contained in:
Jonas Jenwald 2024-11-12 16:56:54 +01:00
parent fe5967c84e
commit 65eedfb0fc
6 changed files with 50 additions and 31 deletions

View file

@ -48,10 +48,12 @@ class BasePdfManager {
this._password = args.password;
this.enableXfa = args.enableXfa;
// Check `OffscreenCanvas` support once, rather than repeatedly throughout
// the worker-thread code.
// Check `OffscreenCanvas` and `ImageDecoder` support once,
// rather than repeatedly throughout the worker-thread code.
args.evaluatorOptions.isOffscreenCanvasSupported &&=
FeatureTest.isOffscreenCanvasSupported;
args.evaluatorOptions.isImageDecoderSupported &&=
FeatureTest.isImageDecoderSupported;
this.evaluatorOptions = Object.freeze(args.evaluatorOptions);
}