Support Blend Modes which are specified in an Array of Names (issue 11279)
According to the specification, the first *supported* Blend Mode should be choosen in this case; please see https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G10.4848607
This commit is contained in:
parent
4a5a4328f4
commit
5c266f0e8c
@ -125,8 +125,23 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Convert PDF blend mode names to HTML5 blend mode names.
|
// Convert PDF blend mode names to HTML5 blend mode names.
|
||||||
function normalizeBlendMode(value) {
|
function normalizeBlendMode(value, parsingArray = false) {
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
// Use the first *supported* BM value in the Array (fixes issue11279.pdf).
|
||||||
|
for (let i = 0, ii = value.length; i < ii; i++) {
|
||||||
|
const maybeBM = normalizeBlendMode(value[i], /* parsingArray = */ true);
|
||||||
|
if (maybeBM) {
|
||||||
|
return maybeBM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
warn(`Unsupported blend mode Array: ${value}`);
|
||||||
|
return 'source-over';
|
||||||
|
}
|
||||||
|
|
||||||
if (!isName(value)) {
|
if (!isName(value)) {
|
||||||
|
if (parsingArray) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return 'source-over';
|
return 'source-over';
|
||||||
}
|
}
|
||||||
switch (value.name) {
|
switch (value.name) {
|
||||||
@ -164,7 +179,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
case 'Luminosity':
|
case 'Luminosity':
|
||||||
return 'luminosity';
|
return 'luminosity';
|
||||||
}
|
}
|
||||||
warn('Unsupported blend mode: ' + value.name);
|
if (parsingArray) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
warn(`Unsupported blend mode: ${value.name}`);
|
||||||
return 'source-over';
|
return 'source-over';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -85,6 +85,7 @@
|
|||||||
!issue11045.pdf
|
!issue11045.pdf
|
||||||
!issue11150_reduced.pdf
|
!issue11150_reduced.pdf
|
||||||
!issue11242_reduced.pdf
|
!issue11242_reduced.pdf
|
||||||
|
!issue11279.pdf
|
||||||
!bad-PageLabels.pdf
|
!bad-PageLabels.pdf
|
||||||
!decodeACSuccessive.pdf
|
!decodeACSuccessive.pdf
|
||||||
!filled-background.pdf
|
!filled-background.pdf
|
||||||
|
BIN
test/pdfs/issue11279.pdf
Normal file
BIN
test/pdfs/issue11279.pdf
Normal file
Binary file not shown.
@ -1512,6 +1512,13 @@
|
|||||||
"link": false,
|
"link": false,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue11279",
|
||||||
|
"file": "pdfs/issue11279.pdf",
|
||||||
|
"md5": "03361d24f3ed63b93f77abf731f8fc73",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": false,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue8480",
|
{ "id": "issue8480",
|
||||||
"file": "pdfs/issue8480.pdf",
|
"file": "pdfs/issue8480.pdf",
|
||||||
"md5": "769bc07bf8041d95667f2d32aaf75665",
|
"md5": "769bc07bf8041d95667f2d32aaf75665",
|
||||||
|
Loading…
Reference in New Issue
Block a user