Stop warning for non-Name /Filter entries in the PDFImage constructor (PR 9897 follow-up)

Fixes a stupid oversight on my part, since /Filter may (obviously) contain an Array, which resulted in unnecessary console warning spam in perfectly valid PDF files.
Note that it still makes sense to check that /Filter is actually a Name, before attempting to access its `name` property, but the warning should definitely be removed.
This commit is contained in:
Jonas Jenwald 2018-08-03 09:59:18 +02:00
parent 8a4be24645
commit a504befc76

View File

@ -83,7 +83,7 @@ var PDFImage = (function PDFImageClosure() {
mask = null, isMask = false, pdfFunctionFactory, }) { mask = null, isMask = false, pdfFunctionFactory, }) {
this.image = image; this.image = image;
var dict = image.dict; var dict = image.dict;
if (dict.has('Filter')) {
const filter = dict.get('Filter'); const filter = dict.get('Filter');
if (isName(filter)) { if (isName(filter)) {
switch (filter.name) { switch (filter.name) {
@ -102,9 +102,6 @@ var PDFImage = (function PDFImageClosure() {
image.numComps = 1; image.numComps = 1;
break; break;
} }
} else {
warn(`PDFImage - invalid /Filter entry in dictionary: "${filter}".`);
}
} }
// TODO cache rendered images? // TODO cache rendered images?