better-pdfjs-rails 1.6.380.5 → 1.6.422.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/better/pdfjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/generic/build/pdf.js +68 -17
- data/vendor/assets/javascripts/generic/build/pdf.worker.js +139 -74
- data/vendor/assets/javascripts/generic/web/compatibility.js +3 -1
- data/vendor/assets/javascripts/generic/web/locale/ast/viewer.properties +2 -0
- data/vendor/assets/javascripts/generic/web/locale/az/viewer.properties +7 -0
- data/vendor/assets/javascripts/generic/web/locale/bn-BD/viewer.properties +5 -0
- data/vendor/assets/javascripts/generic/web/locale/el/viewer.properties +6 -1
- data/vendor/assets/javascripts/generic/web/locale/eo/viewer.properties +8 -0
- data/vendor/assets/javascripts/generic/web/locale/es-MX/viewer.properties +5 -0
- data/vendor/assets/javascripts/generic/web/locale/ff/viewer.properties +8 -0
- data/vendor/assets/javascripts/generic/web/locale/ga-IE/viewer.properties +8 -0
- data/vendor/assets/javascripts/generic/web/locale/hi-IN/viewer.properties +1 -0
- data/vendor/assets/javascripts/generic/web/locale/km/viewer.properties +9 -1
- data/vendor/assets/javascripts/generic/web/locale/mr/viewer.properties +5 -0
- data/vendor/assets/javascripts/generic/web/locale/nb-NO/viewer.properties +7 -0
- data/vendor/assets/javascripts/generic/web/locale/ro/viewer.properties +7 -0
- data/vendor/assets/javascripts/generic/web/locale/sl/viewer.properties +8 -0
- data/vendor/assets/javascripts/generic/web/locale/xh/viewer.properties +8 -0
- data/vendor/assets/javascripts/generic/web/locale/zh-CN/viewer.properties +1 -1
- data/vendor/assets/javascripts/generic/web/viewer.css +17 -3
- data/vendor/assets/javascripts/generic/web/viewer.js +258 -247
- data/vendor/assets/javascripts/pdf.js +68 -17
- data/vendor/assets/javascripts/pdf.worker.js +139 -74
- data/vendor/assets/javascripts/version.json +3 -3
- data/vendor/assets/javascripts/viewer.js +258 -247
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa40ca37b668a719fab978d036f0a6969308c3d8
|
4
|
+
data.tar.gz: 65a80bc9d1e0bfe1fa2bb056042e276e50a0af64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28e2e3acdd25e9e32d8a2baebc14da80447be4d8516736cb378de4c5f98d4409ef9a0e68dae65322dafe646f66ed9074559212bf13d1007fbf7129882f6dcd54
|
7
|
+
data.tar.gz: 89b22678bf8d6dd14d3d50e5cc58d6ce5336c7b27aef8d51dbd5aa1fc2be43abb2e6f965afa8dc6e1945c4be952b7155434e50e1f7c83aa186b8512a6edbaa50
|
@@ -23,8 +23,8 @@
|
|
23
23
|
}
|
24
24
|
}(this, function (exports) {
|
25
25
|
'use strict';
|
26
|
-
var pdfjsVersion = '1.6.
|
27
|
-
var pdfjsBuild = '
|
26
|
+
var pdfjsVersion = '1.6.422';
|
27
|
+
var pdfjsBuild = 'aabfb77';
|
28
28
|
var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
|
29
29
|
var pdfjsLibs = {};
|
30
30
|
(function pdfjsWrapper() {
|
@@ -3800,6 +3800,15 @@
|
|
3800
3800
|
switch (fieldType) {
|
3801
3801
|
case 'Tx':
|
3802
3802
|
return new TextWidgetAnnotationElement(parameters);
|
3803
|
+
case 'Btn':
|
3804
|
+
if (parameters.data.radioButton) {
|
3805
|
+
return new RadioButtonWidgetAnnotationElement(parameters);
|
3806
|
+
} else if (parameters.data.checkBox) {
|
3807
|
+
return new CheckboxWidgetAnnotationElement(parameters);
|
3808
|
+
} else {
|
3809
|
+
warn('Unimplemented button widget annotation: pushbutton');
|
3810
|
+
}
|
3811
|
+
break;
|
3803
3812
|
case 'Ch':
|
3804
3813
|
return new ChoiceWidgetAnnotationElement(parameters);
|
3805
3814
|
}
|
@@ -4067,6 +4076,45 @@
|
|
4067
4076
|
});
|
4068
4077
|
return TextWidgetAnnotationElement;
|
4069
4078
|
}();
|
4079
|
+
var CheckboxWidgetAnnotationElement = function CheckboxWidgetAnnotationElementClosure() {
|
4080
|
+
function CheckboxWidgetAnnotationElement(parameters) {
|
4081
|
+
WidgetAnnotationElement.call(this, parameters, parameters.renderInteractiveForms);
|
4082
|
+
}
|
4083
|
+
Util.inherit(CheckboxWidgetAnnotationElement, WidgetAnnotationElement, {
|
4084
|
+
render: function CheckboxWidgetAnnotationElement_render() {
|
4085
|
+
this.container.className = 'buttonWidgetAnnotation checkBox';
|
4086
|
+
var element = document.createElement('input');
|
4087
|
+
element.disabled = this.data.readOnly;
|
4088
|
+
element.type = 'checkbox';
|
4089
|
+
if (this.data.fieldValue && this.data.fieldValue !== 'Off') {
|
4090
|
+
element.setAttribute('checked', true);
|
4091
|
+
}
|
4092
|
+
this.container.appendChild(element);
|
4093
|
+
return this.container;
|
4094
|
+
}
|
4095
|
+
});
|
4096
|
+
return CheckboxWidgetAnnotationElement;
|
4097
|
+
}();
|
4098
|
+
var RadioButtonWidgetAnnotationElement = function RadioButtonWidgetAnnotationElementClosure() {
|
4099
|
+
function RadioButtonWidgetAnnotationElement(parameters) {
|
4100
|
+
WidgetAnnotationElement.call(this, parameters, parameters.renderInteractiveForms);
|
4101
|
+
}
|
4102
|
+
Util.inherit(RadioButtonWidgetAnnotationElement, WidgetAnnotationElement, {
|
4103
|
+
render: function RadioButtonWidgetAnnotationElement_render() {
|
4104
|
+
this.container.className = 'buttonWidgetAnnotation radioButton';
|
4105
|
+
var element = document.createElement('input');
|
4106
|
+
element.disabled = this.data.readOnly;
|
4107
|
+
element.type = 'radio';
|
4108
|
+
element.name = this.data.fieldName;
|
4109
|
+
if (this.data.fieldValue === this.data.buttonValue) {
|
4110
|
+
element.setAttribute('checked', true);
|
4111
|
+
}
|
4112
|
+
this.container.appendChild(element);
|
4113
|
+
return this.container;
|
4114
|
+
}
|
4115
|
+
});
|
4116
|
+
return RadioButtonWidgetAnnotationElement;
|
4117
|
+
}();
|
4070
4118
|
var ChoiceWidgetAnnotationElement = function ChoiceWidgetAnnotationElementClosure() {
|
4071
4119
|
function ChoiceWidgetAnnotationElement(parameters) {
|
4072
4120
|
WidgetAnnotationElement.call(this, parameters, parameters.renderInteractiveForms);
|
@@ -7094,11 +7142,11 @@
|
|
7094
7142
|
paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, bbox) {
|
7095
7143
|
this.save();
|
7096
7144
|
this.baseTransformStack.push(this.baseTransform);
|
7097
|
-
if (isArray(matrix) &&
|
7145
|
+
if (isArray(matrix) && matrix.length === 6) {
|
7098
7146
|
this.transform.apply(this, matrix);
|
7099
7147
|
}
|
7100
7148
|
this.baseTransform = this.ctx.mozCurrentTransform;
|
7101
|
-
if (isArray(bbox) &&
|
7149
|
+
if (isArray(bbox) && bbox.length === 4) {
|
7102
7150
|
var width = bbox[2] - bbox[0];
|
7103
7151
|
var height = bbox[3] - bbox[1];
|
7104
7152
|
this.ctx.rect(bbox[0], bbox[1], width, height);
|
@@ -7226,7 +7274,7 @@
|
|
7226
7274
|
},
|
7227
7275
|
beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, matrix) {
|
7228
7276
|
this.save();
|
7229
|
-
if (isArray(rect) &&
|
7277
|
+
if (isArray(rect) && rect.length === 4) {
|
7230
7278
|
var width = rect[2] - rect[0];
|
7231
7279
|
var height = rect[3] - rect[1];
|
7232
7280
|
this.ctx.rect(rect[0], rect[1], width, height);
|
@@ -8304,6 +8352,7 @@
|
|
8304
8352
|
this.fontLoader = new FontLoader(loadingTask.docId);
|
8305
8353
|
this.destroyed = false;
|
8306
8354
|
this.destroyCapability = null;
|
8355
|
+
this._passwordCapability = null;
|
8307
8356
|
this.pageCache = [];
|
8308
8357
|
this.pagePromises = [];
|
8309
8358
|
this.downloadInfoCapability = createPromiseCapability();
|
@@ -8316,6 +8365,9 @@
|
|
8316
8365
|
}
|
8317
8366
|
this.destroyed = true;
|
8318
8367
|
this.destroyCapability = createPromiseCapability();
|
8368
|
+
if (this._passwordCapability) {
|
8369
|
+
this._passwordCapability.reject(new Error('Worker was destroyed during onPassword callback'));
|
8370
|
+
}
|
8319
8371
|
var waitOn = [];
|
8320
8372
|
this.pageCache.forEach(function (page) {
|
8321
8373
|
if (page) {
|
@@ -8343,9 +8395,7 @@
|
|
8343
8395
|
},
|
8344
8396
|
setupMessageHandler: function WorkerTransport_setupMessageHandler() {
|
8345
8397
|
var messageHandler = this.messageHandler;
|
8346
|
-
|
8347
|
-
messageHandler.send('UpdatePassword', password);
|
8348
|
-
}
|
8398
|
+
var loadingTask = this.loadingTask;
|
8349
8399
|
var pdfDataRangeTransport = this.pdfDataRangeTransport;
|
8350
8400
|
if (pdfDataRangeTransport) {
|
8351
8401
|
pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
|
@@ -8372,18 +8422,19 @@
|
|
8372
8422
|
this.pdfDocument = pdfDocument;
|
8373
8423
|
loadingTask._capability.resolve(pdfDocument);
|
8374
8424
|
}, this);
|
8375
|
-
messageHandler.on('
|
8376
|
-
|
8425
|
+
messageHandler.on('PasswordRequest', function transportPasswordRequest(exception) {
|
8426
|
+
this._passwordCapability = createPromiseCapability();
|
8377
8427
|
if (loadingTask.onPassword) {
|
8378
|
-
|
8428
|
+
var updatePassword = function (password) {
|
8429
|
+
this._passwordCapability.resolve({ password: password });
|
8430
|
+
}.bind(this);
|
8431
|
+
loadingTask.onPassword(updatePassword, exception.code);
|
8432
|
+
} else {
|
8433
|
+
this._passwordCapability.reject(new PasswordException(exception.message, exception.code));
|
8379
8434
|
}
|
8380
|
-
|
8435
|
+
return this._passwordCapability.promise;
|
8381
8436
|
}, this);
|
8382
|
-
messageHandler.on('
|
8383
|
-
var loadingTask = this.loadingTask;
|
8384
|
-
if (loadingTask.onPassword) {
|
8385
|
-
return loadingTask.onPassword(updatePassword, PasswordResponses.INCORRECT_PASSWORD);
|
8386
|
-
}
|
8437
|
+
messageHandler.on('PasswordException', function transportPasswordException(exception) {
|
8387
8438
|
loadingTask._capability.reject(new PasswordException(exception.message, exception.code));
|
8388
8439
|
}, this);
|
8389
8440
|
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
|
@@ -23,8 +23,8 @@
|
|
23
23
|
}
|
24
24
|
}(this, function (exports) {
|
25
25
|
'use strict';
|
26
|
-
var pdfjsVersion = '1.6.
|
27
|
-
var pdfjsBuild = '
|
26
|
+
var pdfjsVersion = '1.6.422';
|
27
|
+
var pdfjsBuild = 'aabfb77';
|
28
28
|
var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
|
29
29
|
var pdfjsLibs = {};
|
30
30
|
(function pdfjsWrapper() {
|
@@ -33306,18 +33306,18 @@
|
|
33306
33306
|
}();
|
33307
33307
|
var CipherTransform = function CipherTransformClosure() {
|
33308
33308
|
function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
|
33309
|
-
this.
|
33310
|
-
this.
|
33309
|
+
this.StringCipherConstructor = stringCipherConstructor;
|
33310
|
+
this.StreamCipherConstructor = streamCipherConstructor;
|
33311
33311
|
}
|
33312
33312
|
CipherTransform.prototype = {
|
33313
33313
|
createStream: function CipherTransform_createStream(stream, length) {
|
33314
|
-
var cipher = new this.
|
33314
|
+
var cipher = new this.StreamCipherConstructor();
|
33315
33315
|
return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
|
33316
33316
|
return cipher.decryptBlock(data, finalize);
|
33317
33317
|
});
|
33318
33318
|
},
|
33319
33319
|
decryptString: function CipherTransform_decryptString(s) {
|
33320
|
-
var cipher = new this.
|
33320
|
+
var cipher = new this.StringCipherConstructor();
|
33321
33321
|
var data = stringToBytes(s);
|
33322
33322
|
data = cipher.decryptBlock(data, true);
|
33323
33323
|
return bytesToString(data);
|
@@ -33602,17 +33602,17 @@
|
|
33602
33602
|
return new NullCipher();
|
33603
33603
|
};
|
33604
33604
|
}
|
33605
|
-
if ('V2'
|
33605
|
+
if (cfm.name === 'V2') {
|
33606
33606
|
return function cipherTransformFactoryBuildCipherConstructorV2() {
|
33607
33607
|
return new ARCFourCipher(buildObjectKey(num, gen, key, false));
|
33608
33608
|
};
|
33609
33609
|
}
|
33610
|
-
if ('AESV2'
|
33610
|
+
if (cfm.name === 'AESV2') {
|
33611
33611
|
return function cipherTransformFactoryBuildCipherConstructorAESV2() {
|
33612
33612
|
return new AES128Cipher(buildObjectKey(num, gen, key, true));
|
33613
33613
|
};
|
33614
33614
|
}
|
33615
|
-
if ('AESV3'
|
33615
|
+
if (cfm.name === 'AESV3') {
|
33616
33616
|
return function cipherTransformFactoryBuildCipherConstructorAESV3() {
|
33617
33617
|
return new AES256Cipher(key);
|
33618
33618
|
};
|
@@ -39628,6 +39628,7 @@
|
|
39628
39628
|
function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
|
39629
39629
|
var charCodeToGlyphId = Object.create(null);
|
39630
39630
|
var glyphId, charCode, baseEncoding;
|
39631
|
+
var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
|
39631
39632
|
if (properties.baseEncodingName) {
|
39632
39633
|
baseEncoding = getEncoding(properties.baseEncodingName);
|
39633
39634
|
for (charCode = 0; charCode < baseEncoding.length; charCode++) {
|
@@ -39638,7 +39639,7 @@
|
|
39638
39639
|
charCodeToGlyphId[charCode] = 0;
|
39639
39640
|
}
|
39640
39641
|
}
|
39641
|
-
} else if (
|
39642
|
+
} else if (isSymbolicFont) {
|
39642
39643
|
for (charCode in builtInEncoding) {
|
39643
39644
|
charCodeToGlyphId[charCode] = builtInEncoding[charCode];
|
39644
39645
|
}
|
@@ -43323,12 +43324,12 @@
|
|
43323
43324
|
return Catalog;
|
43324
43325
|
}();
|
43325
43326
|
var XRef = function XRefClosure() {
|
43326
|
-
function XRef(stream,
|
43327
|
+
function XRef(stream, pdfManager) {
|
43327
43328
|
this.stream = stream;
|
43329
|
+
this.pdfManager = pdfManager;
|
43328
43330
|
this.entries = [];
|
43329
43331
|
this.xrefstms = Object.create(null);
|
43330
43332
|
this.cache = [];
|
43331
|
-
this.password = password;
|
43332
43333
|
this.stats = {
|
43333
43334
|
streamTypes: [],
|
43334
43335
|
fontTypes: []
|
@@ -43349,11 +43350,11 @@
|
|
43349
43350
|
trailerDict.assignXref(this);
|
43350
43351
|
this.trailer = trailerDict;
|
43351
43352
|
var encrypt = trailerDict.get('Encrypt');
|
43352
|
-
if (encrypt) {
|
43353
|
+
if (isDict(encrypt)) {
|
43353
43354
|
var ids = trailerDict.get('ID');
|
43354
43355
|
var fileId = ids && ids.length ? ids[0] : '';
|
43355
43356
|
encrypt.suppressEncryption = true;
|
43356
|
-
this.encrypt = new CipherTransformFactory(encrypt, fileId, this.password);
|
43357
|
+
this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
|
43357
43358
|
}
|
43358
43359
|
if (!(this.root = trailerDict.get('Root'))) {
|
43359
43360
|
error('Invalid root reference');
|
@@ -46070,10 +46071,10 @@
|
|
46070
46071
|
}
|
46071
46072
|
if (!font.vertical) {
|
46072
46073
|
textChunk.lastAdvanceWidth = width;
|
46073
|
-
textChunk.width += width
|
46074
|
+
textChunk.width += width;
|
46074
46075
|
} else {
|
46075
46076
|
textChunk.lastAdvanceHeight = height;
|
46076
|
-
textChunk.height += Math.abs(height
|
46077
|
+
textChunk.height += Math.abs(height);
|
46077
46078
|
}
|
46078
46079
|
return textChunk;
|
46079
46080
|
}
|
@@ -46094,6 +46095,8 @@
|
|
46094
46095
|
if (!textContentItem.initialized) {
|
46095
46096
|
return;
|
46096
46097
|
}
|
46098
|
+
textContentItem.width *= textContentItem.textAdvanceScale;
|
46099
|
+
textContentItem.height *= textContentItem.textAdvanceScale;
|
46097
46100
|
textContent.items.push(runBidiTransform(textContentItem));
|
46098
46101
|
textContentItem.initialized = false;
|
46099
46102
|
textContentItem.str.length = 0;
|
@@ -46206,16 +46209,16 @@
|
|
46206
46209
|
advance = items[j] * textState.fontSize / 1000;
|
46207
46210
|
var breakTextRun = false;
|
46208
46211
|
if (textState.font.vertical) {
|
46209
|
-
offset = advance
|
46210
|
-
textState.translateTextMatrix(0,
|
46212
|
+
offset = advance;
|
46213
|
+
textState.translateTextMatrix(0, offset);
|
46211
46214
|
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
|
46212
46215
|
if (!breakTextRun) {
|
46213
46216
|
textContentItem.height += offset;
|
46214
46217
|
}
|
46215
46218
|
} else {
|
46216
46219
|
advance = -advance;
|
46217
|
-
offset = advance *
|
46218
|
-
textState.translateTextMatrix(
|
46220
|
+
offset = advance * textState.textHScale;
|
46221
|
+
textState.translateTextMatrix(offset, 0);
|
46219
46222
|
breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
|
46220
46223
|
if (!breakTextRun) {
|
46221
46224
|
textContentItem.width += offset;
|
@@ -46709,7 +46712,16 @@
|
|
46709
46712
|
} else if (isRef(entry)) {
|
46710
46713
|
hash.update(entry.toString());
|
46711
46714
|
} else if (isArray(entry)) {
|
46712
|
-
|
46715
|
+
var diffLength = entry.length, diffBuf = new Array(diffLength);
|
46716
|
+
for (var j = 0; j < diffLength; j++) {
|
46717
|
+
var diffEntry = entry[j];
|
46718
|
+
if (isName(diffEntry)) {
|
46719
|
+
diffBuf[j] = diffEntry.name;
|
46720
|
+
} else if (isNum(diffEntry) || isRef(diffEntry)) {
|
46721
|
+
diffBuf[j] = diffEntry.toString();
|
46722
|
+
}
|
46723
|
+
}
|
46724
|
+
hash.update(diffBuf.join());
|
46713
46725
|
}
|
46714
46726
|
}
|
46715
46727
|
}
|
@@ -47985,6 +47997,8 @@
|
|
47985
47997
|
switch (fieldType) {
|
47986
47998
|
case 'Tx':
|
47987
47999
|
return new TextWidgetAnnotation(parameters);
|
48000
|
+
case 'Btn':
|
48001
|
+
return new ButtonWidgetAnnotation(parameters);
|
47988
48002
|
case 'Ch':
|
47989
48003
|
return new ChoiceWidgetAnnotation(parameters);
|
47990
48004
|
}
|
@@ -48412,17 +48426,72 @@
|
|
48412
48426
|
});
|
48413
48427
|
return TextWidgetAnnotation;
|
48414
48428
|
}();
|
48429
|
+
var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
|
48430
|
+
function ButtonWidgetAnnotation(params) {
|
48431
|
+
WidgetAnnotation.call(this, params);
|
48432
|
+
this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
|
48433
|
+
if (this.data.checkBox) {
|
48434
|
+
if (!isName(this.data.fieldValue)) {
|
48435
|
+
return;
|
48436
|
+
}
|
48437
|
+
this.data.fieldValue = this.data.fieldValue.name;
|
48438
|
+
}
|
48439
|
+
this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
|
48440
|
+
if (this.data.radioButton) {
|
48441
|
+
this.data.fieldValue = this.data.buttonValue = null;
|
48442
|
+
var fieldParent = params.dict.get('Parent');
|
48443
|
+
if (!isDict(fieldParent) || !fieldParent.has('V')) {
|
48444
|
+
return;
|
48445
|
+
}
|
48446
|
+
var fieldParentValue = fieldParent.get('V');
|
48447
|
+
if (!isName(fieldParentValue)) {
|
48448
|
+
return;
|
48449
|
+
}
|
48450
|
+
this.data.fieldValue = fieldParentValue.name;
|
48451
|
+
var appearanceStates = params.dict.get('AP');
|
48452
|
+
if (!isDict(appearanceStates)) {
|
48453
|
+
return;
|
48454
|
+
}
|
48455
|
+
var normalAppearanceState = appearanceStates.get('N');
|
48456
|
+
if (!isDict(normalAppearanceState)) {
|
48457
|
+
return;
|
48458
|
+
}
|
48459
|
+
var keys = normalAppearanceState.getKeys();
|
48460
|
+
for (var i = 0, ii = keys.length; i < ii; i++) {
|
48461
|
+
if (keys[i] !== 'Off') {
|
48462
|
+
this.data.buttonValue = keys[i];
|
48463
|
+
break;
|
48464
|
+
}
|
48465
|
+
}
|
48466
|
+
}
|
48467
|
+
}
|
48468
|
+
Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
|
48469
|
+
getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
|
48470
|
+
var operatorList = new OperatorList();
|
48471
|
+
if (renderForms) {
|
48472
|
+
return Promise.resolve(operatorList);
|
48473
|
+
}
|
48474
|
+
if (this.appearance) {
|
48475
|
+
return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
|
48476
|
+
}
|
48477
|
+
return Promise.resolve(operatorList);
|
48478
|
+
}
|
48479
|
+
});
|
48480
|
+
return ButtonWidgetAnnotation;
|
48481
|
+
}();
|
48415
48482
|
var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
|
48416
48483
|
function ChoiceWidgetAnnotation(params) {
|
48417
48484
|
WidgetAnnotation.call(this, params);
|
48418
48485
|
this.data.options = [];
|
48419
|
-
var options = params.dict.
|
48486
|
+
var options = params.dict.get('Opt');
|
48420
48487
|
if (isArray(options)) {
|
48488
|
+
var xref = params.xref;
|
48421
48489
|
for (var i = 0, ii = options.length; i < ii; i++) {
|
48422
|
-
var option = options[i];
|
48490
|
+
var option = xref.fetchIfRef(options[i]);
|
48491
|
+
var isOptionArray = isArray(option);
|
48423
48492
|
this.data.options[i] = {
|
48424
|
-
exportValue:
|
48425
|
-
displayValue:
|
48493
|
+
exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
|
48494
|
+
displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
|
48426
48495
|
};
|
48427
48496
|
}
|
48428
48497
|
}
|
@@ -48818,21 +48887,19 @@
|
|
48818
48887
|
var PDFDocument = function PDFDocumentClosure() {
|
48819
48888
|
var FINGERPRINT_FIRST_BYTES = 1024;
|
48820
48889
|
var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
|
48821
|
-
function PDFDocument(pdfManager, arg
|
48890
|
+
function PDFDocument(pdfManager, arg) {
|
48891
|
+
var stream;
|
48822
48892
|
if (isStream(arg)) {
|
48823
|
-
|
48893
|
+
stream = arg;
|
48824
48894
|
} else if (isArrayBuffer(arg)) {
|
48825
|
-
|
48895
|
+
stream = new Stream(arg);
|
48826
48896
|
} else {
|
48827
48897
|
error('PDFDocument: Unknown argument type');
|
48828
48898
|
}
|
48829
|
-
}
|
48830
|
-
function init(pdfManager, stream, password) {
|
48831
48899
|
assert(stream.length > 0, 'stream must have data');
|
48832
48900
|
this.pdfManager = pdfManager;
|
48833
48901
|
this.stream = stream;
|
48834
|
-
|
48835
|
-
this.xref = xref;
|
48902
|
+
this.xref = new XRef(stream, pdfManager);
|
48836
48903
|
}
|
48837
48904
|
function find(stream, needle, limit, backwards) {
|
48838
48905
|
var pos = stream.pos;
|
@@ -49065,6 +49132,9 @@
|
|
49065
49132
|
get docId() {
|
49066
49133
|
return this._docId;
|
49067
49134
|
},
|
49135
|
+
get password() {
|
49136
|
+
return this._password;
|
49137
|
+
},
|
49068
49138
|
get docBaseUrl() {
|
49069
49139
|
var docBaseUrl = null;
|
49070
49140
|
if (this._docBaseUrl) {
|
@@ -49108,14 +49178,7 @@
|
|
49108
49178
|
return new NotImplementedException();
|
49109
49179
|
},
|
49110
49180
|
updatePassword: function BasePdfManager_updatePassword(password) {
|
49111
|
-
this.
|
49112
|
-
if (this._passwordChangedCapability) {
|
49113
|
-
this._passwordChangedCapability.resolve();
|
49114
|
-
}
|
49115
|
-
},
|
49116
|
-
passwordChanged: function BasePdfManager_passwordChanged() {
|
49117
|
-
this._passwordChangedCapability = createPromiseCapability();
|
49118
|
-
return this._passwordChangedCapability.promise;
|
49181
|
+
this._password = password;
|
49119
49182
|
},
|
49120
49183
|
terminate: function BasePdfManager_terminate() {
|
49121
49184
|
return new NotImplementedException();
|
@@ -49126,10 +49189,11 @@
|
|
49126
49189
|
var LocalPdfManager = function LocalPdfManagerClosure() {
|
49127
49190
|
function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
|
49128
49191
|
this._docId = docId;
|
49192
|
+
this._password = password;
|
49129
49193
|
this._docBaseUrl = docBaseUrl;
|
49130
49194
|
this.evaluatorOptions = evaluatorOptions;
|
49131
49195
|
var stream = new Stream(data);
|
49132
|
-
this.pdfDocument = new PDFDocument(this, stream
|
49196
|
+
this.pdfDocument = new PDFDocument(this, stream);
|
49133
49197
|
this._loadedStreamCapability = createPromiseCapability();
|
49134
49198
|
this._loadedStreamCapability.resolve(stream);
|
49135
49199
|
}
|
@@ -49168,6 +49232,7 @@
|
|
49168
49232
|
var NetworkPdfManager = function NetworkPdfManagerClosure() {
|
49169
49233
|
function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
|
49170
49234
|
this._docId = docId;
|
49235
|
+
this._password = args.password;
|
49171
49236
|
this._docBaseUrl = docBaseUrl;
|
49172
49237
|
this.msgHandler = args.msgHandler;
|
49173
49238
|
this.evaluatorOptions = evaluatorOptions;
|
@@ -49179,7 +49244,7 @@
|
|
49179
49244
|
rangeChunkSize: args.rangeChunkSize
|
49180
49245
|
};
|
49181
49246
|
this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
|
49182
|
-
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream()
|
49247
|
+
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
|
49183
49248
|
}
|
49184
49249
|
Util.inherit(NetworkPdfManager, BasePdfManager, {
|
49185
49250
|
ensure: function NetworkPdfManager_ensure(obj, prop, args) {
|
@@ -49681,18 +49746,23 @@
|
|
49681
49746
|
};
|
49682
49747
|
return pdfManagerCapability.promise;
|
49683
49748
|
}
|
49684
|
-
|
49685
|
-
|
49749
|
+
function setupDoc(data) {
|
49750
|
+
function onSuccess(doc) {
|
49686
49751
|
ensureNotTerminated();
|
49687
49752
|
handler.send('GetDoc', { pdfInfo: doc });
|
49688
|
-
}
|
49689
|
-
|
49753
|
+
}
|
49754
|
+
function onFailure(e) {
|
49690
49755
|
if (e instanceof PasswordException) {
|
49691
|
-
|
49692
|
-
|
49693
|
-
|
49694
|
-
|
49695
|
-
|
49756
|
+
var task = new WorkerTask('PasswordException: response ' + e.code);
|
49757
|
+
startWorkerTask(task);
|
49758
|
+
handler.sendWithPromise('PasswordRequest', e).then(function (data) {
|
49759
|
+
finishWorkerTask(task);
|
49760
|
+
pdfManager.updatePassword(data.password);
|
49761
|
+
pdfManagerReady();
|
49762
|
+
}).catch(function (ex) {
|
49763
|
+
finishWorkerTask(task);
|
49764
|
+
handler.send('PasswordException', ex);
|
49765
|
+
}.bind(null, e));
|
49696
49766
|
} else if (e instanceof InvalidPDFException) {
|
49697
49767
|
handler.send('InvalidPDF', e);
|
49698
49768
|
} else if (e instanceof MissingPDFException) {
|
@@ -49702,7 +49772,22 @@
|
|
49702
49772
|
} else {
|
49703
49773
|
handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
|
49704
49774
|
}
|
49705
|
-
}
|
49775
|
+
}
|
49776
|
+
function pdfManagerReady() {
|
49777
|
+
ensureNotTerminated();
|
49778
|
+
loadDocument(false).then(onSuccess, function loadFailure(ex) {
|
49779
|
+
ensureNotTerminated();
|
49780
|
+
if (!(ex instanceof XRefParseException)) {
|
49781
|
+
onFailure(ex);
|
49782
|
+
return;
|
49783
|
+
}
|
49784
|
+
pdfManager.requestLoadedStream();
|
49785
|
+
pdfManager.onLoadedStream().then(function () {
|
49786
|
+
ensureNotTerminated();
|
49787
|
+
loadDocument(true).then(onSuccess, onFailure);
|
49788
|
+
});
|
49789
|
+
}, onFailure);
|
49790
|
+
}
|
49706
49791
|
ensureNotTerminated();
|
49707
49792
|
var cMapOptions = {
|
49708
49793
|
url: data.cMapUrl === undefined ? null : data.cMapUrl,
|
@@ -49724,25 +49809,8 @@
|
|
49724
49809
|
pdfManager.onLoadedStream().then(function (stream) {
|
49725
49810
|
handler.send('DataLoaded', { length: stream.bytes.byteLength });
|
49726
49811
|
});
|
49727
|
-
}).then(
|
49728
|
-
|
49729
|
-
loadDocument(false).then(onSuccess, function loadFailure(ex) {
|
49730
|
-
ensureNotTerminated();
|
49731
|
-
if (!(ex instanceof XRefParseException)) {
|
49732
|
-
if (ex instanceof PasswordException) {
|
49733
|
-
pdfManager.passwordChanged().then(pdfManagerReady);
|
49734
|
-
}
|
49735
|
-
onFailure(ex);
|
49736
|
-
return;
|
49737
|
-
}
|
49738
|
-
pdfManager.requestLoadedStream();
|
49739
|
-
pdfManager.onLoadedStream().then(function () {
|
49740
|
-
ensureNotTerminated();
|
49741
|
-
loadDocument(true).then(onSuccess, onFailure);
|
49742
|
-
});
|
49743
|
-
}, onFailure);
|
49744
|
-
}, onFailure);
|
49745
|
-
};
|
49812
|
+
}).then(pdfManagerReady, onFailure);
|
49813
|
+
}
|
49746
49814
|
handler.on('GetPage', function wphSetupGetPage(data) {
|
49747
49815
|
return pdfManager.getPage(data.pageIndex).then(function (page) {
|
49748
49816
|
var rotatePromise = pdfManager.ensure(page, 'rotate');
|
@@ -49802,9 +49870,6 @@
|
|
49802
49870
|
handler.on('GetStats', function wphSetupGetStats(data) {
|
49803
49871
|
return pdfManager.pdfDocument.xref.stats;
|
49804
49872
|
});
|
49805
|
-
handler.on('UpdatePassword', function wphSetupUpdatePassword(data) {
|
49806
|
-
pdfManager.updatePassword(data);
|
49807
|
-
});
|
49808
49873
|
handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
|
49809
49874
|
return pdfManager.getPage(data.pageIndex).then(function (page) {
|
49810
49875
|
return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
|