Support images with /Filter-entries that contain Arrays (issue 15220)
This patch "borrows" the code found in the `Parser.makeInlineImage`-method, to ensure that JBIG2 and JPX images can be rendered correctly.
This commit is contained in:
parent
9cc5260b68
commit
fc018ea9ea
@ -103,8 +103,16 @@ class PDFImage {
|
|||||||
const dict = image.dict;
|
const dict = image.dict;
|
||||||
|
|
||||||
const filter = dict.get("F", "Filter");
|
const filter = dict.get("F", "Filter");
|
||||||
|
let filterName;
|
||||||
if (filter instanceof Name) {
|
if (filter instanceof Name) {
|
||||||
switch (filter.name) {
|
filterName = filter.name;
|
||||||
|
} else if (Array.isArray(filter)) {
|
||||||
|
const filterZero = xref.fetchIfRef(filter[0]);
|
||||||
|
if (filterZero instanceof Name) {
|
||||||
|
filterName = filterZero.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (filterName) {
|
||||||
case "JPXDecode":
|
case "JPXDecode":
|
||||||
const jpxImage = new JpxImage();
|
const jpxImage = new JpxImage();
|
||||||
jpxImage.parseImageProperties(image.stream);
|
jpxImage.parseImageProperties(image.stream);
|
||||||
@ -120,8 +128,6 @@ class PDFImage {
|
|||||||
image.numComps = 1;
|
image.numComps = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// TODO cache rendered images?
|
|
||||||
|
|
||||||
let width = dict.get("W", "Width");
|
let width = dict.get("W", "Width");
|
||||||
let height = dict.get("H", "Height");
|
let height = dict.get("H", "Height");
|
||||||
|
1
test/pdfs/issue15220.pdf.link
Normal file
1
test/pdfs/issue15220.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://github.com/mozilla/pdf.js/files/9178570/issue15220_page2.pdf
|
@ -152,6 +152,14 @@
|
|||||||
"lastPage": 1,
|
"lastPage": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue15220",
|
||||||
|
"file": "pdfs/issue15220.pdf",
|
||||||
|
"md5": "0864a9e3860c0cb5e98b5eb23287fba4",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"lastPage": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue11549",
|
{ "id": "issue11549",
|
||||||
"file": "pdfs/issue11549_reduced.pdf",
|
"file": "pdfs/issue11549_reduced.pdf",
|
||||||
"md5": "a1ea636f413e02e10dbdf379ab4a99ae",
|
"md5": "a1ea636f413e02e10dbdf379ab4a99ae",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user