pdfjs-dist 2.5.207 → 2.6.347
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.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/bower.json +1 -1
- package/build/pdf.js +867 -216
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +10214 -8547
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/es5/build/pdf.js +2023 -1046
- package/es5/build/pdf.js.map +1 -1
- package/es5/build/pdf.min.js +22 -0
- package/es5/build/pdf.worker.js +11136 -8144
- package/es5/build/pdf.worker.js.map +1 -1
- package/es5/build/pdf.worker.min.js +22 -0
- package/es5/image_decoders/pdf.image_decoders.js +12529 -0
- package/es5/image_decoders/pdf.image_decoders.js.map +1 -0
- package/es5/image_decoders/pdf.image_decoders.min.js +22 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/pdf_viewer.css +8 -5
- package/es5/web/pdf_viewer.js +195 -51
- package/es5/web/pdf_viewer.js.map +1 -1
- package/image_decoders/pdf.image_decoders.js +24 -16
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +1 -1
- package/lib/core/annotation.js +479 -43
- package/lib/core/cff_parser.js +643 -615
- package/lib/core/chunked_stream.js +64 -50
- package/lib/core/colorspace.js +126 -104
- package/lib/core/crypto.js +37 -0
- package/lib/core/document.js +128 -75
- package/lib/core/evaluator.js +3015 -2754
- package/lib/core/fonts.js +47 -46
- package/lib/core/function.js +79 -6
- package/lib/core/image.js +364 -357
- package/lib/core/image_utils.js +109 -8
- package/lib/core/jpg.js +8 -3
- package/lib/core/obj.js +255 -34
- package/lib/core/operator_list.js +17 -15
- package/lib/core/parser.js +40 -3
- package/lib/core/pattern.js +24 -11
- package/lib/core/primitives.js +112 -53
- package/lib/core/type1_parser.js +2 -0
- package/lib/core/worker.js +102 -37
- package/lib/core/writer.js +242 -0
- package/lib/display/annotation_layer.js +51 -10
- package/lib/display/annotation_storage.js +89 -0
- package/lib/display/api.js +140 -54
- package/lib/display/canvas.js +215 -46
- package/lib/display/display_utils.js +55 -18
- package/lib/display/fetch_stream.js +6 -0
- package/lib/display/font_loader.js +26 -15
- package/lib/display/metadata.js +1 -7
- package/lib/display/network.js +0 -14
- package/lib/display/node_utils.js +87 -0
- package/lib/display/optional_content_config.js +184 -0
- package/lib/display/svg.js +1 -1
- package/lib/display/text_layer.js +4 -1
- package/lib/pdf.js +2 -2
- package/lib/pdf.worker.js +2 -2
- package/lib/shared/is_node.js +1 -1
- package/lib/shared/util.js +13 -10
- package/lib/test/unit/annotation_spec.js +520 -50
- package/lib/test/unit/annotation_storage_spec.js +83 -0
- package/lib/test/unit/api_spec.js +16 -6
- package/lib/test/unit/cmap_spec.js +4 -4
- package/lib/test/unit/colorspace_spec.js +216 -24
- package/lib/test/unit/crypto_spec.js +51 -4
- package/lib/test/unit/custom_spec.js +129 -1
- package/lib/test/unit/document_spec.js +112 -1
- package/lib/test/unit/evaluator_spec.js +29 -10
- package/lib/test/unit/jasmine-boot.js +1 -1
- package/lib/test/unit/metadata_spec.js +3 -3
- package/lib/test/unit/primitives_spec.js +242 -63
- package/lib/test/unit/test_utils.js +42 -89
- package/lib/test/unit/testreporter.js +17 -6
- package/lib/test/unit/util_spec.js +13 -12
- package/lib/test/unit/writer_spec.js +84 -0
- package/lib/web/annotation_layer_builder.js +13 -9
- package/lib/web/app.js +231 -26
- package/lib/web/app_options.js +1 -6
- package/lib/web/base_tree_viewer.js +100 -0
- package/lib/web/base_viewer.js +53 -4
- package/lib/web/download_manager.js +3 -10
- package/lib/web/firefox_print_service.js +32 -12
- package/lib/web/firefoxcom.js +20 -6
- package/lib/web/interfaces.js +1 -1
- package/lib/web/pdf_attachment_viewer.js +80 -38
- package/lib/web/pdf_find_controller.js +2 -1
- package/lib/web/pdf_layer_viewer.js +208 -0
- package/lib/web/pdf_outline_viewer.js +24 -57
- package/lib/web/pdf_page_view.js +29 -6
- package/lib/web/pdf_print_service.js +13 -11
- package/lib/web/pdf_sidebar.js +46 -25
- package/lib/web/pdf_thumbnail_view.js +16 -3
- package/lib/web/pdf_thumbnail_viewer.js +17 -1
- package/lib/web/pdf_viewer.component.js +2 -2
- package/lib/web/preferences.js +1 -1
- package/lib/web/toolbar.js +1 -1
- package/lib/web/ui_utils.js +7 -1
- package/package.json +3 -1
- package/types/display/annotation_layer.d.ts +61 -0
- package/types/display/annotation_storage.d.ts +36 -0
- package/types/display/api.d.ts +1107 -0
- package/types/display/api_compatibility.d.ts +1 -0
- package/types/display/canvas.d.ts +4 -0
- package/types/display/content_disposition.d.ts +7 -0
- package/types/display/display_utils.d.ts +243 -0
- package/types/display/fetch_stream.d.ts +67 -0
- package/types/display/font_loader.d.ts +19 -0
- package/types/display/metadata.d.ts +9 -0
- package/types/display/network.d.ts +80 -0
- package/types/display/network_utils.d.ts +14 -0
- package/types/display/node_stream.d.ts +72 -0
- package/types/display/node_utils.d.ts +6 -0
- package/types/display/optional_content_config.d.ts +12 -0
- package/types/display/pattern_helper.d.ts +5 -0
- package/types/display/svg.d.ts +2 -0
- package/types/display/text_layer.d.ts +83 -0
- package/types/display/transport_stream.d.ts +57 -0
- package/types/display/webgl.d.ts +20 -0
- package/types/display/worker_options.d.ts +27 -0
- package/types/display/xml_parser.d.ts +35 -0
- package/types/pdf.d.ts +33 -0
- package/types/shared/compatibility.d.ts +1 -0
- package/types/shared/is_node.d.ts +1 -0
- package/types/shared/message_handler.d.ts +62 -0
- package/types/shared/util.d.ts +421 -0
- package/web/images/shadow.png +0 -0
- package/web/pdf_viewer.css +8 -5
- package/web/pdf_viewer.js +109 -33
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +1 -9
- package/es5/web/images/texture.png +0 -0
- package/web/images/texture.png +0 -0
package/lib/core/crypto.js
CHANGED
@@ -83,6 +83,7 @@ var ARCFourCipher = function ARCFourCipherClosure() {
|
|
83
83
|
}
|
84
84
|
};
|
85
85
|
ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
|
86
|
+
ARCFourCipher.prototype.encrypt = ARCFourCipher.prototype.encryptBlock;
|
86
87
|
return ARCFourCipher;
|
87
88
|
}();
|
88
89
|
|
@@ -622,6 +623,9 @@ var NullCipher = function NullCipherClosure() {
|
|
622
623
|
NullCipher.prototype = {
|
623
624
|
decryptBlock: function NullCipher_decryptBlock(data) {
|
624
625
|
return data;
|
626
|
+
},
|
627
|
+
encrypt: function NullCipher_encrypt(data) {
|
628
|
+
return data;
|
625
629
|
}
|
626
630
|
};
|
627
631
|
return NullCipher;
|
@@ -1235,6 +1239,39 @@ var CipherTransform = function CipherTransformClosure() {
|
|
1235
1239
|
var data = (0, _util.stringToBytes)(s);
|
1236
1240
|
data = cipher.decryptBlock(data, true);
|
1237
1241
|
return (0, _util.bytesToString)(data);
|
1242
|
+
},
|
1243
|
+
encryptString: function CipherTransform_encryptString(s) {
|
1244
|
+
const cipher = new this.StringCipherConstructor();
|
1245
|
+
|
1246
|
+
if (cipher instanceof AESBaseCipher) {
|
1247
|
+
const strLen = s.length;
|
1248
|
+
const pad = 16 - strLen % 16;
|
1249
|
+
|
1250
|
+
if (pad !== 16) {
|
1251
|
+
s = s.padEnd(16 * Math.ceil(strLen / 16), String.fromCharCode(pad));
|
1252
|
+
}
|
1253
|
+
|
1254
|
+
const iv = new Uint8Array(16);
|
1255
|
+
|
1256
|
+
if (typeof crypto !== "undefined") {
|
1257
|
+
crypto.getRandomValues(iv);
|
1258
|
+
} else {
|
1259
|
+
for (let i = 0; i < 16; i++) {
|
1260
|
+
iv[i] = Math.floor(256 * Math.random());
|
1261
|
+
}
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
let data = (0, _util.stringToBytes)(s);
|
1265
|
+
data = cipher.encrypt(data, iv);
|
1266
|
+
const buf = new Uint8Array(16 + data.length);
|
1267
|
+
buf.set(iv);
|
1268
|
+
buf.set(data, 16);
|
1269
|
+
return (0, _util.bytesToString)(buf);
|
1270
|
+
}
|
1271
|
+
|
1272
|
+
let data = (0, _util.stringToBytes)(s);
|
1273
|
+
data = cipher.encrypt(data);
|
1274
|
+
return (0, _util.bytesToString)(data);
|
1238
1275
|
}
|
1239
1276
|
};
|
1240
1277
|
return CipherTransform;
|
package/lib/core/document.js
CHANGED
@@ -46,8 +46,6 @@ var _operator_list = require("./operator_list.js");
|
|
46
46
|
|
47
47
|
var _evaluator = require("./evaluator.js");
|
48
48
|
|
49
|
-
var _function = require("./function.js");
|
50
|
-
|
51
49
|
const DEFAULT_USER_UNIT = 1.0;
|
52
50
|
const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
|
53
51
|
|
@@ -62,10 +60,10 @@ class Page {
|
|
62
60
|
pageIndex,
|
63
61
|
pageDict,
|
64
62
|
ref,
|
63
|
+
globalIdFactory,
|
65
64
|
fontCache,
|
66
65
|
builtInCMapCache,
|
67
|
-
globalImageCache
|
68
|
-
pdfFunctionFactory
|
66
|
+
globalImageCache
|
69
67
|
}) {
|
70
68
|
this.pdfManager = pdfManager;
|
71
69
|
this.pageIndex = pageIndex;
|
@@ -75,19 +73,14 @@ class Page {
|
|
75
73
|
this.fontCache = fontCache;
|
76
74
|
this.builtInCMapCache = builtInCMapCache;
|
77
75
|
this.globalImageCache = globalImageCache;
|
78
|
-
this.pdfFunctionFactory = pdfFunctionFactory;
|
79
76
|
this.evaluatorOptions = pdfManager.evaluatorOptions;
|
80
77
|
this.resourcesPromise = null;
|
81
78
|
const idCounters = {
|
82
79
|
obj: 0
|
83
80
|
};
|
84
|
-
this.
|
85
|
-
createObjId() {
|
81
|
+
this._localIdFactory = class extends globalIdFactory {
|
82
|
+
static createObjId() {
|
86
83
|
return `p${pageIndex}_${++idCounters.obj}`;
|
87
|
-
},
|
88
|
-
|
89
|
-
getDocId() {
|
90
|
-
return `g_${pdfManager.docId}`;
|
91
84
|
}
|
92
85
|
|
93
86
|
};
|
@@ -109,7 +102,10 @@ class Page {
|
|
109
102
|
return value[0];
|
110
103
|
}
|
111
104
|
|
112
|
-
return _primitives.Dict.merge(
|
105
|
+
return _primitives.Dict.merge({
|
106
|
+
xref: this.xref,
|
107
|
+
dictArray: value
|
108
|
+
});
|
113
109
|
}
|
114
110
|
|
115
111
|
get content() {
|
@@ -210,6 +206,35 @@ class Page {
|
|
210
206
|
return stream;
|
211
207
|
}
|
212
208
|
|
209
|
+
save(handler, task, annotationStorage) {
|
210
|
+
const partialEvaluator = new _evaluator.PartialEvaluator({
|
211
|
+
xref: this.xref,
|
212
|
+
handler,
|
213
|
+
pageIndex: this.pageIndex,
|
214
|
+
idFactory: this._localIdFactory,
|
215
|
+
fontCache: this.fontCache,
|
216
|
+
builtInCMapCache: this.builtInCMapCache,
|
217
|
+
globalImageCache: this.globalImageCache,
|
218
|
+
options: this.evaluatorOptions
|
219
|
+
});
|
220
|
+
return this._parsedAnnotations.then(function (annotations) {
|
221
|
+
const newRefsPromises = [];
|
222
|
+
|
223
|
+
for (const annotation of annotations) {
|
224
|
+
if (!isAnnotationRenderable(annotation, "print")) {
|
225
|
+
continue;
|
226
|
+
}
|
227
|
+
|
228
|
+
newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
|
229
|
+
(0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
|
230
|
+
return null;
|
231
|
+
}));
|
232
|
+
}
|
233
|
+
|
234
|
+
return Promise.all(newRefsPromises);
|
235
|
+
});
|
236
|
+
}
|
237
|
+
|
213
238
|
loadResources(keys) {
|
214
239
|
if (!this.resourcesPromise) {
|
215
240
|
this.resourcesPromise = this.pdfManager.ensure(this, "resources");
|
@@ -226,7 +251,8 @@ class Page {
|
|
226
251
|
sink,
|
227
252
|
task,
|
228
253
|
intent,
|
229
|
-
renderInteractiveForms
|
254
|
+
renderInteractiveForms,
|
255
|
+
annotationStorage
|
230
256
|
}) {
|
231
257
|
const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
|
232
258
|
const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
|
@@ -234,16 +260,15 @@ class Page {
|
|
234
260
|
xref: this.xref,
|
235
261
|
handler,
|
236
262
|
pageIndex: this.pageIndex,
|
237
|
-
idFactory: this.
|
263
|
+
idFactory: this._localIdFactory,
|
238
264
|
fontCache: this.fontCache,
|
239
265
|
builtInCMapCache: this.builtInCMapCache,
|
240
266
|
globalImageCache: this.globalImageCache,
|
241
|
-
options: this.evaluatorOptions
|
242
|
-
pdfFunctionFactory: this.pdfFunctionFactory
|
267
|
+
options: this.evaluatorOptions
|
243
268
|
});
|
244
269
|
const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
|
245
270
|
const pageListPromise = dataPromises.then(([contentStream]) => {
|
246
|
-
const opList = new _operator_list.OperatorList(intent, sink
|
271
|
+
const opList = new _operator_list.OperatorList(intent, sink);
|
247
272
|
handler.send("StartRenderPage", {
|
248
273
|
transparency: partialEvaluator.hasBlendModes(this.resources),
|
249
274
|
pageIndex: this.pageIndex,
|
@@ -270,7 +295,7 @@ class Page {
|
|
270
295
|
|
271
296
|
for (const annotation of annotations) {
|
272
297
|
if (isAnnotationRenderable(annotation, intent)) {
|
273
|
-
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms).catch(function (reason) {
|
298
|
+
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms, annotationStorage).catch(function (reason) {
|
274
299
|
(0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
|
275
300
|
return null;
|
276
301
|
}));
|
@@ -308,12 +333,11 @@ class Page {
|
|
308
333
|
xref: this.xref,
|
309
334
|
handler,
|
310
335
|
pageIndex: this.pageIndex,
|
311
|
-
idFactory: this.
|
336
|
+
idFactory: this._localIdFactory,
|
312
337
|
fontCache: this.fontCache,
|
313
338
|
builtInCMapCache: this.builtInCMapCache,
|
314
339
|
globalImageCache: this.globalImageCache,
|
315
|
-
options: this.evaluatorOptions
|
316
|
-
pdfFunctionFactory: this.pdfFunctionFactory
|
340
|
+
options: this.evaluatorOptions
|
317
341
|
});
|
318
342
|
return partialEvaluator.getTextContent({
|
319
343
|
stream: contentStream,
|
@@ -349,7 +373,7 @@ class Page {
|
|
349
373
|
const annotationPromises = [];
|
350
374
|
|
351
375
|
for (const annotationRef of this.annotations) {
|
352
|
-
annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this.
|
376
|
+
annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory).catch(function (reason) {
|
353
377
|
(0, _util.warn)(`_parsedAnnotations: "${reason}".`);
|
354
378
|
return null;
|
355
379
|
}));
|
@@ -440,53 +464,33 @@ class PDFDocument {
|
|
440
464
|
this.pdfManager = pdfManager;
|
441
465
|
this.stream = stream;
|
442
466
|
this.xref = new _obj.XRef(stream, pdfManager);
|
443
|
-
this.pdfFunctionFactory = new _function.PDFFunctionFactory({
|
444
|
-
xref: this.xref,
|
445
|
-
isEvalSupported: pdfManager.evaluatorOptions.isEvalSupported
|
446
|
-
});
|
447
467
|
this._pagePromises = [];
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
this.pdfFormatVersion = version.name;
|
456
|
-
}
|
457
|
-
|
458
|
-
try {
|
459
|
-
this.acroForm = this.catalog.catDict.get("AcroForm");
|
460
|
-
|
461
|
-
if (this.acroForm) {
|
462
|
-
this.xfa = this.acroForm.get("XFA");
|
463
|
-
const fields = this.acroForm.get("Fields");
|
464
|
-
|
465
|
-
if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) {
|
466
|
-
this.acroForm = null;
|
467
|
-
}
|
468
|
+
this._version = null;
|
469
|
+
const idCounters = {
|
470
|
+
font: 0
|
471
|
+
};
|
472
|
+
this._globalIdFactory = class {
|
473
|
+
static getDocId() {
|
474
|
+
return `g_${pdfManager.docId}`;
|
468
475
|
}
|
469
|
-
|
470
|
-
|
471
|
-
|
476
|
+
|
477
|
+
static createFontId() {
|
478
|
+
return `f${++idCounters.font}`;
|
472
479
|
}
|
473
480
|
|
474
|
-
(
|
475
|
-
|
476
|
-
|
481
|
+
static createObjId() {
|
482
|
+
(0, _util.unreachable)("Abstract method `createObjId` called.");
|
483
|
+
}
|
477
484
|
|
478
|
-
|
479
|
-
|
485
|
+
};
|
486
|
+
}
|
480
487
|
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
} catch (ex) {
|
485
|
-
if (ex instanceof _core_utils.MissingDataException) {
|
486
|
-
throw ex;
|
487
|
-
}
|
488
|
+
parse(recoveryMode) {
|
489
|
+
this.xref.parse(recoveryMode);
|
490
|
+
this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
|
488
491
|
|
489
|
-
|
492
|
+
if (this.catalog.version) {
|
493
|
+
this._version = this.catalog.version;
|
490
494
|
}
|
491
495
|
}
|
492
496
|
|
@@ -580,8 +584,8 @@ class PDFDocument {
|
|
580
584
|
version += String.fromCharCode(ch);
|
581
585
|
}
|
582
586
|
|
583
|
-
if (!this.
|
584
|
-
this.
|
587
|
+
if (!this._version) {
|
588
|
+
this._version = version.substring(5);
|
585
589
|
}
|
586
590
|
}
|
587
591
|
|
@@ -589,17 +593,66 @@ class PDFDocument {
|
|
589
593
|
this.xref.setStartXRef(this.startXRef);
|
590
594
|
}
|
591
595
|
|
592
|
-
setup(recoveryMode) {
|
593
|
-
this.xref.parse(recoveryMode);
|
594
|
-
this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
|
595
|
-
}
|
596
|
-
|
597
596
|
get numPages() {
|
598
597
|
const linearization = this.linearization;
|
599
598
|
const num = linearization ? linearization.numPages : this.catalog.numPages;
|
600
599
|
return (0, _util.shadow)(this, "numPages", num);
|
601
600
|
}
|
602
601
|
|
602
|
+
_hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
|
603
|
+
const RECURSION_LIMIT = 10;
|
604
|
+
return fields.every(field => {
|
605
|
+
field = this.xref.fetchIfRef(field);
|
606
|
+
|
607
|
+
if (field.has("Kids")) {
|
608
|
+
if (++recursionDepth > RECURSION_LIMIT) {
|
609
|
+
(0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
|
610
|
+
return false;
|
611
|
+
}
|
612
|
+
|
613
|
+
return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
|
614
|
+
}
|
615
|
+
|
616
|
+
const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
|
617
|
+
const rectangle = field.get("Rect");
|
618
|
+
const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
|
619
|
+
return isSignature && isInvisible;
|
620
|
+
});
|
621
|
+
}
|
622
|
+
|
623
|
+
get formInfo() {
|
624
|
+
const formInfo = {
|
625
|
+
hasAcroForm: false,
|
626
|
+
hasXfa: false
|
627
|
+
};
|
628
|
+
const acroForm = this.catalog.acroForm;
|
629
|
+
|
630
|
+
if (!acroForm) {
|
631
|
+
return (0, _util.shadow)(this, "formInfo", formInfo);
|
632
|
+
}
|
633
|
+
|
634
|
+
try {
|
635
|
+
const xfa = acroForm.get("XFA");
|
636
|
+
const hasXfa = Array.isArray(xfa) && xfa.length > 0 || (0, _primitives.isStream)(xfa) && !xfa.isEmpty;
|
637
|
+
formInfo.hasXfa = hasXfa;
|
638
|
+
const fields = acroForm.get("Fields");
|
639
|
+
const hasFields = Array.isArray(fields) && fields.length > 0;
|
640
|
+
const sigFlags = acroForm.get("SigFlags");
|
641
|
+
|
642
|
+
const hasOnlyDocumentSignatures = !!(sigFlags & 0x1) && this._hasOnlyDocumentSignatures(fields);
|
643
|
+
|
644
|
+
formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
|
645
|
+
} catch (ex) {
|
646
|
+
if (ex instanceof _core_utils.MissingDataException) {
|
647
|
+
throw ex;
|
648
|
+
}
|
649
|
+
|
650
|
+
(0, _util.info)("Cannot fetch form information.");
|
651
|
+
}
|
652
|
+
|
653
|
+
return (0, _util.shadow)(this, "formInfo", formInfo);
|
654
|
+
}
|
655
|
+
|
603
656
|
get documentInfo() {
|
604
657
|
const DocumentInfoValidators = {
|
605
658
|
Title: _util.isString,
|
@@ -612,7 +665,7 @@ class PDFDocument {
|
|
612
665
|
ModDate: _util.isString,
|
613
666
|
Trapped: _primitives.isName
|
614
667
|
};
|
615
|
-
let version = this.
|
668
|
+
let version = this._version;
|
616
669
|
|
617
670
|
if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
|
618
671
|
(0, _util.warn)(`Invalid PDF header version number: ${version}`);
|
@@ -622,9 +675,9 @@ class PDFDocument {
|
|
622
675
|
const docInfo = {
|
623
676
|
PDFFormatVersion: version,
|
624
677
|
IsLinearized: !!this.linearization,
|
625
|
-
IsAcroFormPresent:
|
626
|
-
IsXFAPresent:
|
627
|
-
IsCollectionPresent: !!this.collection
|
678
|
+
IsAcroFormPresent: this.formInfo.hasAcroForm,
|
679
|
+
IsXFAPresent: this.formInfo.hasXfa,
|
680
|
+
IsCollectionPresent: !!this.catalog.collection
|
628
681
|
};
|
629
682
|
let infoDict;
|
630
683
|
|
@@ -733,10 +786,10 @@ class PDFDocument {
|
|
733
786
|
pageIndex,
|
734
787
|
pageDict,
|
735
788
|
ref,
|
789
|
+
globalIdFactory: this._globalIdFactory,
|
736
790
|
fontCache: catalog.fontCache,
|
737
791
|
builtInCMapCache: catalog.builtInCMapCache,
|
738
|
-
globalImageCache: catalog.globalImageCache
|
739
|
-
pdfFunctionFactory: this.pdfFunctionFactory
|
792
|
+
globalImageCache: catalog.globalImageCache
|
740
793
|
});
|
741
794
|
});
|
742
795
|
}
|