mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-21 07:38:07 +02:00
Merge pull request #9470 from Snuffleupagus/issue-4888
Ensure that `JpegImage.getData` returns the correct data length when `forceRGBoutput == true` (issue 4888)
This commit is contained in:
commit
a89071bdef
2 changed files with 24 additions and 3 deletions
|
@ -18,7 +18,7 @@ import {
|
|||
} from './test_utils';
|
||||
import {
|
||||
createPromiseCapability, FontType, InvalidPDFException, MissingPDFException,
|
||||
PasswordException, PasswordResponses, StreamType, stringToBytes
|
||||
OPS, PasswordException, PasswordResponses, StreamType, stringToBytes
|
||||
} from '../../src/shared/util';
|
||||
import {
|
||||
DOMCanvasFactory, RenderingCancelledException
|
||||
|
@ -1104,6 +1104,25 @@ describe('api', function() {
|
|||
done.fail(reason);
|
||||
});
|
||||
});
|
||||
it('gets operatorList with JPEG image (issue 4888)', function(done) {
|
||||
let loadingTask = getDocument(buildGetDocumentParams('cmykjpeg.pdf'));
|
||||
|
||||
loadingTask.promise.then((pdfDoc) => {
|
||||
pdfDoc.getPage(1).then((pdfPage) => {
|
||||
pdfPage.getOperatorList().then((opList) => {
|
||||
let imgIndex = opList.fnArray.indexOf(OPS.paintImageXObject);
|
||||
let imgArgs = opList.argsArray[imgIndex];
|
||||
let { data: imgData, } = pdfPage.objs.get(imgArgs[0]);
|
||||
|
||||
expect(imgData instanceof Uint8ClampedArray).toEqual(true);
|
||||
expect(imgData.length).toEqual(90000);
|
||||
done();
|
||||
});
|
||||
});
|
||||
}).catch(function (reason) {
|
||||
done.fail(reason);
|
||||
});
|
||||
});
|
||||
it('gets stats after parsing page', function (done) {
|
||||
var promise = page.getOperatorList().then(function () {
|
||||
return pdfDocument.getStats();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue