1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #18468 from calixteman/dont_throw_with_invalid_cs

Fallback on DeviceGray when a colorspace cannot be parsed
This commit is contained in:
calixteman 2024-07-21 20:53:46 +02:00 committed by GitHub
commit 422b3e4a4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -396,7 +396,9 @@ class ColorSpace {
}
}
}
throw new FormatError(`Unrecognized ColorSpace: ${cs.name}`);
// Fallback to the default gray color space.
warn(`Unrecognized ColorSpace: ${cs.name}`);
return this.singletons.gray;
}
}
if (Array.isArray(cs)) {
@ -474,10 +476,14 @@ class ColorSpace {
const range = params.getArray("Range");
return new LabCS(whitePoint, blackPoint, range);
default:
throw new FormatError(`Unimplemented ColorSpace object: ${mode}`);
// Fallback to the default gray color space.
warn(`Unimplemented ColorSpace object: ${mode}`);
return this.singletons.gray;
}
}
throw new FormatError(`Unrecognized ColorSpace object: ${cs}`);
// Fallback to the default gray color space.
warn(`Unrecognized ColorSpace object: ${cs}`);
return this.singletons.gray;
}
/**