Merge pull request #8638 from Snuffleupagus/issue-4926-built-in-jpg

In `src/core/jpg.js`, ensure that the Adobe JPEG marker always takes precedence, even when the color transform code is zero
This commit is contained in:
Tim van der Meij 2017-07-22 17:25:09 +02:00 committed by GitHub
commit 7ded895d0c
3 changed files with 18 additions and 7 deletions

View File

@ -958,12 +958,13 @@ var JpegImage = (function JpegImageClosure() {
return data; return data;
}, },
_isColorConversionNeeded: function isColorConversionNeeded() { _isColorConversionNeeded() {
if (this.adobe && this.adobe.transformCode) { if (this.adobe) {
// The adobe transform marker overrides any previous setting // The adobe transform marker overrides any previous setting.
return true; return !!this.adobe.transformCode;
} else if (this.numComponents === 3) { }
if (!this.adobe && this.colorTransform === 0) { if (this.numComponents === 3) {
if (this.colorTransform === 0) {
// If the Adobe transform marker is not present and the image // If the Adobe transform marker is not present and the image
// dictionary has a 'ColorTransform' entry, explicitly set to `0`, // dictionary has a 'ColorTransform' entry, explicitly set to `0`,
// then the colours should *not* be transformed. // then the colours should *not* be transformed.
@ -972,7 +973,7 @@ var JpegImage = (function JpegImageClosure() {
return true; return true;
} }
// `this.numComponents !== 3` // `this.numComponents !== 3`
if (!this.adobe && this.colorTransform === 1) { if (this.colorTransform === 1) {
// If the Adobe transform marker is not present and the image // If the Adobe transform marker is not present and the image
// dictionary has a 'ColorTransform' entry, explicitly set to `1`, // dictionary has a 'ColorTransform' entry, explicitly set to `1`,
// then the colours should be transformed. // then the colours should be transformed.

View File

@ -358,6 +358,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
PDFJS.getDocument({ PDFJS.getDocument({
url: absoluteUrl, url: absoluteUrl,
password: task.password, password: task.password,
nativeImageDecoderSupport: task.nativeImageDecoderSupport,
}).then((doc) => { }).then((doc) => {
task.pdfDoc = doc; task.pdfDoc = doc;
this._nextPage(task, failure); this._nextPage(task, failure);

View File

@ -3378,6 +3378,15 @@
"link": true, "link": true,
"type": "eq" "type": "eq"
}, },
{ "id": "issue4926-built-in-jpg",
"file": "pdfs/issue4926.pdf",
"md5": "ed881c8ea2f9bc4be94ecb7f2b2c149b",
"rounds": 1,
"link": true,
"lastPage": 1,
"type": "eq",
"nativeImageDecoderSupport": "none"
},
{ "id": "issue5592", { "id": "issue5592",
"file": "pdfs/issue5592.pdf", "file": "pdfs/issue5592.pdf",
"md5": "a0750f95afa80c880f7966df7062616c", "md5": "a0750f95afa80c880f7966df7062616c",