diff --git a/src/core/stream.js b/src/core/stream.js index c93be81f1..08e731885 100644 --- a/src/core/stream.js +++ b/src/core/stream.js @@ -735,6 +735,19 @@ var PredictorStream = (function PredictorStreamClosure() { buffer[pos] = buffer[pos - colors] + rawBytes[i]; pos++; } + } else if (bits === 16) { + var bytesPerPixel = colors * 2; + for (i = 0; i < bytesPerPixel; ++i) { + buffer[pos++] = rawBytes[i]; + } + for (; i < rowBytes; i += 2) { + var sum = ((rawBytes[i] & 0xFF) << 8) + + (rawBytes[i + 1] & 0xFF) + + ((buffer[pos - bytesPerPixel] & 0xFF) << 8) + + (buffer[pos - bytesPerPixel + 1] & 0xFF); + buffer[pos++] = ((sum >> 8) & 0xFF); + buffer[pos++] = (sum & 0xFF); + } } else { var compArray = new Uint8Array(colors + 1); var bitMask = (1 << bits) - 1; diff --git a/test/pdfs/issue6289.pdf.link b/test/pdfs/issue6289.pdf.link new file mode 100644 index 000000000..f825dcd8d --- /dev/null +++ b/test/pdfs/issue6289.pdf.link @@ -0,0 +1 @@ +https://issues.apache.org/jira/secure/attachment/12685775/GWG181_16Bit_CMYK_X4.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 0882f4670..eb37fd4a0 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -706,6 +706,14 @@ "lastPage": 1, "type": "eq" }, + { "id": "issue6289", + "file": "pdfs/issue6289.pdf", + "md5": "0869f3d147c734ec484ffd492104095d", + "rounds": 1, + "link": true, + "lastPage": 1, + "type": "eq" + }, { "id": "issue5509", "file": "pdfs/issue5509.pdf", "md5": "1975ef8db7355b1d691bc79d0749574b",