pdfjs-dist 2.4.456 → 2.5.207
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 +4447 -4379
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +8549 -8507
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/es5/build/pdf.js +14755 -14540
- package/es5/build/pdf.js.map +1 -1
- package/es5/build/pdf.worker.js +9830 -9469
- package/es5/build/pdf.worker.js.map +1 -1
- package/es5/web/pdf_viewer.css +5 -9
- package/es5/web/pdf_viewer.js +157 -172
- package/es5/web/pdf_viewer.js.map +1 -1
- package/image_decoders/pdf.image_decoders.js +107 -93
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +1 -1
- package/lib/README.md +2 -2
- package/lib/core/ccitt.js +7 -7
- package/lib/core/cff_parser.js +1 -1
- package/lib/core/chunked_stream.js +5 -5
- package/lib/core/cmap.js +13 -0
- package/lib/core/document.js +22 -18
- package/lib/core/evaluator.js +285 -247
- package/lib/core/font_renderer.js +7 -7
- package/lib/core/fonts.js +163 -147
- package/lib/core/function.js +4 -5
- package/lib/core/glyphlist.js +4523 -4523
- package/lib/core/image.js +19 -44
- package/lib/core/image_utils.js +123 -47
- package/lib/core/jpeg_stream.js +2 -116
- package/lib/core/jpg.js +47 -55
- package/lib/core/jpx.js +6 -6
- package/lib/core/metrics.js +2916 -2916
- package/lib/core/obj.js +18 -7
- package/lib/core/operator_list.js +5 -0
- package/lib/core/parser.js +1 -1
- package/lib/core/pdf_manager.js +2 -2
- package/lib/core/primitives.js +4 -0
- package/lib/core/standard_fonts.js +103 -103
- package/lib/core/type1_parser.js +6 -6
- package/lib/core/worker.js +31 -24
- package/lib/core/worker_stream.js +1 -1
- package/lib/display/annotation_layer.js +3 -0
- package/lib/display/api.js +29 -137
- package/lib/display/api_compatibility.js +11 -18
- package/lib/display/canvas.js +7 -34
- package/lib/display/content_disposition.js +4 -4
- package/lib/display/display_utils.js +6 -15
- package/lib/display/fetch_stream.js +3 -1
- package/lib/display/font_loader.js +2 -2
- package/lib/display/network.js +1 -1
- package/lib/display/node_stream.js +10 -8
- package/lib/display/pattern_helper.js +1 -1
- package/lib/display/svg.js +61 -31
- package/lib/display/text_layer.js +44 -32
- package/lib/display/transport_stream.js +3 -3
- package/lib/pdf.js +210 -48
- package/lib/pdf.worker.js +12 -4
- package/lib/shared/compatibility.js +2 -0
- package/lib/shared/is_node.js +1 -1
- package/lib/shared/message_handler.js +6 -6
- package/lib/shared/util.js +15 -9
- package/lib/test/unit/api_spec.js +165 -95
- package/lib/test/unit/cff_parser_spec.js +12 -12
- package/lib/test/unit/clitests_helper.js +1 -1
- package/lib/test/unit/display_svg_spec.js +1 -5
- package/lib/test/unit/jasmine-boot.js +2 -2
- package/lib/test/unit/node_stream_spec.js +5 -3
- package/lib/test/unit/parser_spec.js +3 -3
- package/lib/test/unit/test_utils.js +1 -1
- package/lib/test/unit/testreporter.js +4 -4
- package/lib/test/unit/ui_utils_spec.js +1 -55
- package/lib/test/unit/unicode_spec.js +1 -1
- package/lib/web/app.js +247 -159
- package/lib/web/app_options.js +16 -10
- package/lib/web/base_viewer.js +14 -6
- package/lib/web/download_manager.js +3 -1
- package/lib/web/firefox_print_service.js +1 -1
- package/lib/web/firefoxcom.js +16 -4
- package/lib/web/pdf_attachment_viewer.js +14 -7
- package/lib/web/pdf_document_properties.js +11 -16
- package/lib/web/pdf_find_bar.js +3 -3
- package/lib/web/pdf_find_controller.js +3 -3
- package/lib/web/pdf_history.js +7 -5
- package/lib/web/pdf_link_service.js +7 -8
- package/lib/web/pdf_page_view.js +1 -1
- package/lib/web/pdf_presentation_mode.js +6 -2
- package/lib/web/pdf_print_service.js +1 -1
- package/lib/web/pdf_single_page_viewer.js +2 -2
- package/lib/web/pdf_viewer.component.js +2 -2
- package/lib/web/pdf_viewer.js +2 -2
- package/lib/web/preferences.js +4 -1
- package/lib/web/text_layer_builder.js +1 -3
- package/lib/web/ui_utils.js +3 -55
- package/lib/web/view_history.js +8 -9
- package/lib/web/viewer_compatibility.js +14 -1
- package/package.json +1 -1
- package/web/pdf_viewer.css +5 -9
- package/web/pdf_viewer.js +97 -127
- package/web/pdf_viewer.js.map +1 -1
package/lib/core/document.js
CHANGED
@@ -64,6 +64,7 @@ class Page {
|
|
64
64
|
ref,
|
65
65
|
fontCache,
|
66
66
|
builtInCMapCache,
|
67
|
+
globalImageCache,
|
67
68
|
pdfFunctionFactory
|
68
69
|
}) {
|
69
70
|
this.pdfManager = pdfManager;
|
@@ -73,6 +74,7 @@ class Page {
|
|
73
74
|
this.ref = ref;
|
74
75
|
this.fontCache = fontCache;
|
75
76
|
this.builtInCMapCache = builtInCMapCache;
|
77
|
+
this.globalImageCache = globalImageCache;
|
76
78
|
this.pdfFunctionFactory = pdfFunctionFactory;
|
77
79
|
this.evaluatorOptions = pdfManager.evaluatorOptions;
|
78
80
|
this.resourcesPromise = null;
|
@@ -194,8 +196,8 @@ class Page {
|
|
194
196
|
const xref = this.xref;
|
195
197
|
const streams = [];
|
196
198
|
|
197
|
-
for (const
|
198
|
-
streams.push(xref.fetchIfRef(
|
199
|
+
for (const subStream of content) {
|
200
|
+
streams.push(xref.fetchIfRef(subStream));
|
199
201
|
}
|
200
202
|
|
201
203
|
stream = new _stream.StreamsSequenceStream(streams);
|
@@ -235,6 +237,7 @@ class Page {
|
|
235
237
|
idFactory: this.idFactory,
|
236
238
|
fontCache: this.fontCache,
|
237
239
|
builtInCMapCache: this.builtInCMapCache,
|
240
|
+
globalImageCache: this.globalImageCache,
|
238
241
|
options: this.evaluatorOptions,
|
239
242
|
pdfFunctionFactory: this.pdfFunctionFactory
|
240
243
|
});
|
@@ -267,7 +270,10 @@ class Page {
|
|
267
270
|
|
268
271
|
for (const annotation of annotations) {
|
269
272
|
if (isAnnotationRenderable(annotation, intent)) {
|
270
|
-
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms))
|
273
|
+
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms).catch(function (reason) {
|
274
|
+
(0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
|
275
|
+
return null;
|
276
|
+
}));
|
271
277
|
}
|
272
278
|
}
|
273
279
|
|
@@ -305,6 +311,7 @@ class Page {
|
|
305
311
|
idFactory: this.idFactory,
|
306
312
|
fontCache: this.fontCache,
|
307
313
|
builtInCMapCache: this.builtInCMapCache,
|
314
|
+
globalImageCache: this.globalImageCache,
|
308
315
|
options: this.evaluatorOptions,
|
309
316
|
pdfFunctionFactory: this.pdfFunctionFactory
|
310
317
|
});
|
@@ -339,20 +346,17 @@ class Page {
|
|
339
346
|
|
340
347
|
get _parsedAnnotations() {
|
341
348
|
const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
|
342
|
-
const annotationRefs = this.annotations;
|
343
349
|
const annotationPromises = [];
|
344
350
|
|
345
|
-
for (
|
346
|
-
annotationPromises.push(_annotation.AnnotationFactory.create(this.xref,
|
351
|
+
for (const annotationRef of this.annotations) {
|
352
|
+
annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory).catch(function (reason) {
|
353
|
+
(0, _util.warn)(`_parsedAnnotations: "${reason}".`);
|
354
|
+
return null;
|
355
|
+
}));
|
347
356
|
}
|
348
357
|
|
349
358
|
return Promise.all(annotationPromises).then(function (annotations) {
|
350
|
-
return annotations.filter(
|
351
|
-
return !!annotation;
|
352
|
-
});
|
353
|
-
}, function (reason) {
|
354
|
-
(0, _util.warn)(`_parsedAnnotations: "${reason}".`);
|
355
|
-
return [];
|
359
|
+
return annotations.filter(annotation => !!annotation);
|
356
360
|
});
|
357
361
|
});
|
358
362
|
return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
|
@@ -656,11 +660,11 @@ class PDFDocument {
|
|
656
660
|
continue;
|
657
661
|
}
|
658
662
|
|
659
|
-
if (!docInfo
|
660
|
-
docInfo
|
663
|
+
if (!docInfo.Custom) {
|
664
|
+
docInfo.Custom = Object.create(null);
|
661
665
|
}
|
662
666
|
|
663
|
-
docInfo
|
667
|
+
docInfo.Custom[key] = customValue;
|
664
668
|
}
|
665
669
|
}
|
666
670
|
}
|
@@ -693,7 +697,6 @@ class PDFDocument {
|
|
693
697
|
catalog,
|
694
698
|
linearization
|
695
699
|
} = this;
|
696
|
-
(0, _util.assert)(linearization && linearization.pageFirst === pageIndex);
|
697
700
|
|
698
701
|
const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
|
699
702
|
|
@@ -732,6 +735,7 @@ class PDFDocument {
|
|
732
735
|
ref,
|
733
736
|
fontCache: catalog.fontCache,
|
734
737
|
builtInCMapCache: catalog.builtInCMapCache,
|
738
|
+
globalImageCache: catalog.globalImageCache,
|
735
739
|
pdfFunctionFactory: this.pdfFunctionFactory
|
736
740
|
});
|
737
741
|
});
|
@@ -751,8 +755,8 @@ class PDFDocument {
|
|
751
755
|
return this.catalog.fontFallback(id, handler);
|
752
756
|
}
|
753
757
|
|
754
|
-
async cleanup() {
|
755
|
-
return this.catalog ? this.catalog.cleanup() : (0, _primitives.clearPrimitiveCaches)();
|
758
|
+
async cleanup(manuallyTriggered = false) {
|
759
|
+
return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
|
756
760
|
}
|
757
761
|
|
758
762
|
}
|