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

Merge pull request #18895 from calixteman/issue18894

Fallback on gray colorspace when there are no colorspace and no name in the scn/SCN arguments
This commit is contained in:
calixteman 2024-10-13 17:56:52 +02:00 committed by GitHub
commit e1f9fa4ea5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 0 deletions

View file

@ -2079,6 +2079,11 @@ class PartialEvaluator {
case OPS.setFillColorN:
cs = stateManager.state.patternFillColorSpace;
if (!cs) {
if (isNumberArray(args, null)) {
args = ColorSpace.singletons.gray.getRgb(args, 0);
fn = OPS.setFillRGBColor;
break;
}
args = [];
fn = OPS.setFillTransparent;
break;
@ -2106,6 +2111,11 @@ class PartialEvaluator {
case OPS.setStrokeColorN:
cs = stateManager.state.patternStrokeColorSpace;
if (!cs) {
if (isNumberArray(args, null)) {
args = ColorSpace.singletons.gray.getRgb(args, 0);
fn = OPS.setStrokeRGBColor;
break;
}
args = [];
fn = OPS.setStrokeTransparent;
break;

View file

@ -675,3 +675,4 @@
!stamps.pdf
!issue15096.pdf
!issue18036.pdf
!issue18894.pdf

BIN
test/pdfs/issue18894.pdf Executable file

Binary file not shown.

View file

@ -10692,5 +10692,13 @@
"rounds": 1,
"type": "eq",
"annotations": true
},
{
"id": "issue18894",
"file": "pdfs/issue18894.pdf",
"md5": "5cd744bf8c0800e93c22ed92d1c162f4",
"rounds": 1,
"type": "eq",
"talos": false
}
]