|
|
@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') { |
|
|
|
(typeof window !== 'undefined' ? window : this).PDFJS = {}; |
|
|
|
(typeof window !== 'undefined' ? window : this).PDFJS = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
PDFJS.version = '1.0.362'; |
|
|
|
PDFJS.version = '1.0.366'; |
|
|
|
PDFJS.build = 'a45e103'; |
|
|
|
PDFJS.build = '834c69a'; |
|
|
|
|
|
|
|
|
|
|
|
(function pdfjsWrapper() { |
|
|
|
(function pdfjsWrapper() { |
|
|
|
// Use strict in our context only - users might not want it
|
|
|
|
// Use strict in our context only - users might not want it
|
|
|
@ -45213,7 +45213,7 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
lbox = length - position + headerSize; |
|
|
|
lbox = length - position + headerSize; |
|
|
|
} |
|
|
|
} |
|
|
|
if (lbox < headerSize) { |
|
|
|
if (lbox < headerSize) { |
|
|
|
error('JPX error: Invalid box field size'); |
|
|
|
throw new Error('JPX Error: Invalid box field size'); |
|
|
|
} |
|
|
|
} |
|
|
|
var dataLength = lbox - headerSize; |
|
|
|
var dataLength = lbox - headerSize; |
|
|
|
var jumpDataLength = true; |
|
|
|
var jumpDataLength = true; |
|
|
@ -45237,7 +45237,6 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
parseImageProperties: function JpxImage_parseImageProperties(stream) { |
|
|
|
parseImageProperties: function JpxImage_parseImageProperties(stream) { |
|
|
|
try { |
|
|
|
|
|
|
|
var newByte = stream.getByte(); |
|
|
|
var newByte = stream.getByte(); |
|
|
|
while (newByte >= 0) { |
|
|
|
while (newByte >= 0) { |
|
|
|
var oldByte = newByte; |
|
|
|
var oldByte = newByte; |
|
|
@ -45260,18 +45259,12 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
throw 'No size marker found in JPX stream'; |
|
|
|
throw new Error('JPX Error: No size marker found in JPX stream'); |
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
if (this.failOnCorruptedImage) { |
|
|
|
|
|
|
|
error('JPX error: ' + e); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
warn('JPX error: ' + e + '. Trying to recover'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
parseCodestream: function JpxImage_parseCodestream(data, start, end) { |
|
|
|
parseCodestream: function JpxImage_parseCodestream(data, start, end) { |
|
|
|
var context = {}; |
|
|
|
var context = {}; |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
var doNotRecover = false; |
|
|
|
var position = start; |
|
|
|
var position = start; |
|
|
|
while (position + 1 < end) { |
|
|
|
while (position + 1 < end) { |
|
|
|
var code = readUint16(data, position); |
|
|
|
var code = readUint16(data, position); |
|
|
@ -45315,6 +45308,11 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
context.QCC = []; |
|
|
|
context.QCC = []; |
|
|
|
context.COC = []; |
|
|
|
context.COC = []; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 0xFF55: // Tile-part lengths, main header (TLM)
|
|
|
|
|
|
|
|
var Ltlm = readUint16(data, position); // Marker segment length
|
|
|
|
|
|
|
|
// Skip tile length markers
|
|
|
|
|
|
|
|
position += Ltlm; |
|
|
|
|
|
|
|
break; |
|
|
|
case 0xFF5C: // Quantization default (QCD)
|
|
|
|
case 0xFF5C: // Quantization default (QCD)
|
|
|
|
length = readUint16(data, position); |
|
|
|
length = readUint16(data, position); |
|
|
|
var qcd = {}; |
|
|
|
var qcd = {}; |
|
|
@ -45334,7 +45332,7 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
scalarExpounded = true; |
|
|
|
scalarExpounded = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw 'Invalid SQcd value ' + sqcd; |
|
|
|
throw new Error('JPX Error: Invalid SQcd value ' + sqcd); |
|
|
|
} |
|
|
|
} |
|
|
|
qcd.noQuantization = (spqcdSize == 8); |
|
|
|
qcd.noQuantization = (spqcdSize == 8); |
|
|
|
qcd.scalarExpounded = scalarExpounded; |
|
|
|
qcd.scalarExpounded = scalarExpounded; |
|
|
@ -45386,7 +45384,7 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
scalarExpounded = true; |
|
|
|
scalarExpounded = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw 'Invalid SQcd value ' + sqcd; |
|
|
|
throw new Error('JPX Error: Invalid SQcd value ' + sqcd); |
|
|
|
} |
|
|
|
} |
|
|
|
qcc.noQuantization = (spqcdSize == 8); |
|
|
|
qcc.noQuantization = (spqcdSize == 8); |
|
|
|
qcc.scalarExpounded = scalarExpounded; |
|
|
|
qcc.scalarExpounded = scalarExpounded; |
|
|
@ -45446,16 +45444,33 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
cod.precinctsSizes = precinctsSizes; |
|
|
|
cod.precinctsSizes = precinctsSizes; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var unsupported = []; |
|
|
|
if (cod.sopMarkerUsed || cod.ephMarkerUsed || |
|
|
|
if (cod.sopMarkerUsed) { |
|
|
|
cod.selectiveArithmeticCodingBypass || |
|
|
|
unsupported.push('sopMarkerUsed'); |
|
|
|
cod.resetContextProbabilities || |
|
|
|
} |
|
|
|
cod.terminationOnEachCodingPass || |
|
|
|
if (cod.ephMarkerUsed) { |
|
|
|
cod.verticalyStripe || cod.predictableTermination) { |
|
|
|
unsupported.push('ephMarkerUsed'); |
|
|
|
throw 'Unsupported COD options: ' + |
|
|
|
} |
|
|
|
globalScope.JSON.stringify(cod); |
|
|
|
if (cod.selectiveArithmeticCodingBypass) { |
|
|
|
|
|
|
|
unsupported.push('selectiveArithmeticCodingBypass'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (cod.resetContextProbabilities) { |
|
|
|
|
|
|
|
unsupported.push('resetContextProbabilities'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (cod.terminationOnEachCodingPass) { |
|
|
|
|
|
|
|
unsupported.push('terminationOnEachCodingPass'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (cod.verticalyStripe) { |
|
|
|
|
|
|
|
unsupported.push('verticalyStripe'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (cod.predictableTermination) { |
|
|
|
|
|
|
|
unsupported.push('predictableTermination'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (unsupported.length > 0) { |
|
|
|
|
|
|
|
doNotRecover = true; |
|
|
|
|
|
|
|
throw new Error('JPX Error: Unsupported COD options (' + |
|
|
|
|
|
|
|
unsupported.join(', ') + ')'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (context.mainHeader) { |
|
|
|
if (context.mainHeader) { |
|
|
|
context.COD = cod; |
|
|
|
context.COD = cod; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -45498,17 +45513,19 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
// skipping content
|
|
|
|
// skipping content
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 0xFF53: // Coding style component (COC)
|
|
|
|
case 0xFF53: // Coding style component (COC)
|
|
|
|
throw 'Codestream code 0xFF53 (COC) is not implemented'; |
|
|
|
throw new Error('JPX Error: Codestream code 0xFF53 (COC) is ' + |
|
|
|
|
|
|
|
'not implemented'); |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw 'Unknown codestream code: ' + code.toString(16); |
|
|
|
throw new Error('JPX Error: Unknown codestream code: ' + |
|
|
|
|
|
|
|
code.toString(16)); |
|
|
|
} |
|
|
|
} |
|
|
|
position += length; |
|
|
|
position += length; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
if (this.failOnCorruptedImage) { |
|
|
|
if (doNotRecover || this.failOnCorruptedImage) { |
|
|
|
error('JPX error: ' + e); |
|
|
|
throw e; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
warn('JPX error: ' + e + '. Trying to recover'); |
|
|
|
warn('Trying to recover from ' + e.message); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.tiles = transformComponents(context); |
|
|
|
this.tiles = transformComponents(context); |
|
|
@ -45736,7 +45753,7 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
r = 0; |
|
|
|
r = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
throw 'Out of packets'; |
|
|
|
throw new Error('JPX Error: Out of packets'); |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
function ResolutionLayerComponentPositionIterator(context) { |
|
|
|
function ResolutionLayerComponentPositionIterator(context) { |
|
|
@ -45776,7 +45793,7 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
l = 0; |
|
|
|
l = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
throw 'Out of packets'; |
|
|
|
throw new Error('JPX Error: Out of packets'); |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
function buildPackets(context) { |
|
|
|
function buildPackets(context) { |
|
|
@ -45871,7 +45888,8 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
new ResolutionLayerComponentPositionIterator(context); |
|
|
|
new ResolutionLayerComponentPositionIterator(context); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw 'Unsupported progression order ' + progressionOrder; |
|
|
|
throw new Error('JPX Error: Unsupported progression order ' + |
|
|
|
|
|
|
|
progressionOrder); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
function parseTilePackets(context, data, offset, dataLength) { |
|
|
|
function parseTilePackets(context, data, offset, dataLength) { |
|
|
@ -46784,7 +46802,7 @@ var JpxImage = (function JpxImageClosure() { |
|
|
|
(decoder.readBit(contexts, UNIFORM_CONTEXT) << 1) | |
|
|
|
(decoder.readBit(contexts, UNIFORM_CONTEXT) << 1) | |
|
|
|
decoder.readBit(contexts, UNIFORM_CONTEXT); |
|
|
|
decoder.readBit(contexts, UNIFORM_CONTEXT); |
|
|
|
if (symbol != 0xA) { |
|
|
|
if (symbol != 0xA) { |
|
|
|
throw 'Invalid segmentation symbol'; |
|
|
|
throw new Error('JPX Error: Invalid segmentation symbol'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|