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/display/svg.js
CHANGED
@@ -366,7 +366,7 @@ exports.SVGGraphics = SVGGraphics;
|
|
366
366
|
let maskCount = 0;
|
367
367
|
let shadingCount = 0;
|
368
368
|
exports.SVGGraphics = SVGGraphics = class SVGGraphics {
|
369
|
-
constructor(commonObjs, objs, forceDataSchema) {
|
369
|
+
constructor(commonObjs, objs, forceDataSchema = false) {
|
370
370
|
this.svgFactory = new _display_utils.DOMSVGFactory();
|
371
371
|
this.current = new SVGExtraState();
|
372
372
|
this.transformMatrix = _util.IDENTITY_MATRIX;
|
@@ -614,10 +614,6 @@ exports.SVGGraphics = SVGGraphics;
|
|
614
614
|
this.paintSolidColorImageMask();
|
615
615
|
break;
|
616
616
|
|
617
|
-
case _util.OPS.paintJpegXObject:
|
618
|
-
this.paintJpegXObject(args[0], args[1], args[2]);
|
619
|
-
break;
|
620
|
-
|
621
617
|
case _util.OPS.paintImageXObject:
|
622
618
|
this.paintImageXObject(args[0]);
|
623
619
|
break;
|
@@ -700,6 +696,7 @@ exports.SVGGraphics = SVGGraphics;
|
|
700
696
|
current.x = current.lineX = 0;
|
701
697
|
current.y = current.lineY = 0;
|
702
698
|
current.xcoords = [];
|
699
|
+
current.ycoords = [];
|
703
700
|
current.tspan = this.svgFactory.createElement("svg:tspan");
|
704
701
|
current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
|
705
702
|
current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
|
@@ -719,6 +716,7 @@ exports.SVGGraphics = SVGGraphics;
|
|
719
716
|
current.txtElement = this.svgFactory.createElement("svg:text");
|
720
717
|
current.txtgrp = this.svgFactory.createElement("svg:g");
|
721
718
|
current.xcoords = [];
|
719
|
+
current.ycoords = [];
|
722
720
|
}
|
723
721
|
|
724
722
|
moveText(x, y) {
|
@@ -726,6 +724,7 @@ exports.SVGGraphics = SVGGraphics;
|
|
726
724
|
current.x = current.lineX += x;
|
727
725
|
current.y = current.lineY += y;
|
728
726
|
current.xcoords = [];
|
727
|
+
current.ycoords = [];
|
729
728
|
current.tspan = this.svgFactory.createElement("svg:tspan");
|
730
729
|
current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
|
731
730
|
current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
|
@@ -741,11 +740,14 @@ exports.SVGGraphics = SVGGraphics;
|
|
741
740
|
return;
|
742
741
|
}
|
743
742
|
|
743
|
+
const fontSizeScale = current.fontSizeScale;
|
744
744
|
const charSpacing = current.charSpacing;
|
745
745
|
const wordSpacing = current.wordSpacing;
|
746
746
|
const fontDirection = current.fontDirection;
|
747
747
|
const textHScale = current.textHScale * fontDirection;
|
748
748
|
const vertical = font.vertical;
|
749
|
+
const spacingDir = vertical ? 1 : -1;
|
750
|
+
const defaultVMetrics = font.defaultVMetrics;
|
749
751
|
const widthAdvanceScale = fontSize * current.fontMatrix[0];
|
750
752
|
let x = 0;
|
751
753
|
|
@@ -754,33 +756,64 @@ exports.SVGGraphics = SVGGraphics;
|
|
754
756
|
x += fontDirection * wordSpacing;
|
755
757
|
continue;
|
756
758
|
} else if ((0, _util.isNum)(glyph)) {
|
757
|
-
x +=
|
759
|
+
x += spacingDir * glyph * fontSize / 1000;
|
758
760
|
continue;
|
759
761
|
}
|
760
762
|
|
761
|
-
const width = glyph.width;
|
762
|
-
const character = glyph.fontChar;
|
763
763
|
const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
|
764
|
-
const
|
764
|
+
const character = glyph.fontChar;
|
765
|
+
let scaledX, scaledY;
|
766
|
+
let width = glyph.width;
|
767
|
+
|
768
|
+
if (vertical) {
|
769
|
+
let vx;
|
770
|
+
const vmetric = glyph.vmetric || defaultVMetrics;
|
771
|
+
vx = glyph.vmetric ? vmetric[1] : width * 0.5;
|
772
|
+
vx = -vx * widthAdvanceScale;
|
773
|
+
const vy = vmetric[2] * widthAdvanceScale;
|
774
|
+
width = vmetric ? -vmetric[0] : width;
|
775
|
+
scaledX = vx / fontSizeScale;
|
776
|
+
scaledY = (x + vy) / fontSizeScale;
|
777
|
+
} else {
|
778
|
+
scaledX = x / fontSizeScale;
|
779
|
+
scaledY = 0;
|
780
|
+
}
|
765
781
|
|
766
|
-
if (
|
767
|
-
x
|
768
|
-
|
782
|
+
if (glyph.isInFont || font.missingFile) {
|
783
|
+
current.xcoords.push(current.x + scaledX);
|
784
|
+
|
785
|
+
if (vertical) {
|
786
|
+
current.ycoords.push(-current.y + scaledY);
|
787
|
+
}
|
788
|
+
|
789
|
+
current.tspan.textContent += character;
|
790
|
+
} else {}
|
791
|
+
|
792
|
+
let charWidth;
|
793
|
+
|
794
|
+
if (vertical) {
|
795
|
+
charWidth = width * widthAdvanceScale - spacing * fontDirection;
|
796
|
+
} else {
|
797
|
+
charWidth = width * widthAdvanceScale + spacing * fontDirection;
|
769
798
|
}
|
770
799
|
|
771
|
-
current.xcoords.push(current.x + x);
|
772
|
-
current.tspan.textContent += character;
|
773
800
|
x += charWidth;
|
774
801
|
}
|
775
802
|
|
803
|
+
current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" "));
|
804
|
+
|
805
|
+
if (vertical) {
|
806
|
+
current.tspan.setAttributeNS(null, "y", current.ycoords.map(pf).join(" "));
|
807
|
+
} else {
|
808
|
+
current.tspan.setAttributeNS(null, "y", pf(-current.y));
|
809
|
+
}
|
810
|
+
|
776
811
|
if (vertical) {
|
777
|
-
current.y -= x
|
812
|
+
current.y -= x;
|
778
813
|
} else {
|
779
814
|
current.x += x * textHScale;
|
780
815
|
}
|
781
816
|
|
782
|
-
current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" "));
|
783
|
-
current.tspan.setAttributeNS(null, "y", pf(-current.y));
|
784
817
|
current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
|
785
818
|
current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
|
786
819
|
|
@@ -835,6 +868,10 @@ exports.SVGGraphics = SVGGraphics;
|
|
835
868
|
}
|
836
869
|
|
837
870
|
addFontStyle(fontObj) {
|
871
|
+
if (!fontObj.data) {
|
872
|
+
throw new Error("addFontStyle: No font data available, " + 'ensure that the "fontExtraProperties" API parameter is set.');
|
873
|
+
}
|
874
|
+
|
838
875
|
if (!this.cssStyle) {
|
839
876
|
this.cssStyle = this.svgFactory.createElement("svg:style");
|
840
877
|
this.cssStyle.setAttributeNS(null, "type", "text/css");
|
@@ -851,7 +888,7 @@ exports.SVGGraphics = SVGGraphics;
|
|
851
888
|
let size = details[1];
|
852
889
|
current.font = fontObj;
|
853
890
|
|
854
|
-
if (this.embedFonts && fontObj.
|
891
|
+
if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) {
|
855
892
|
this.addFontStyle(fontObj);
|
856
893
|
this.embeddedFonts[fontObj.loadedName] = fontObj;
|
857
894
|
}
|
@@ -881,6 +918,7 @@ exports.SVGGraphics = SVGGraphics;
|
|
881
918
|
current.tspan = this.svgFactory.createElement("svg:tspan");
|
882
919
|
current.tspan.setAttributeNS(null, "y", pf(-current.y));
|
883
920
|
current.xcoords = [];
|
921
|
+
current.ycoords = [];
|
884
922
|
}
|
885
923
|
|
886
924
|
endText() {
|
@@ -927,6 +965,7 @@ exports.SVGGraphics = SVGGraphics;
|
|
927
965
|
this.current.fillColor = _util.Util.makeCssRgb(r, g, b);
|
928
966
|
this.current.tspan = this.svgFactory.createElement("svg:tspan");
|
929
967
|
this.current.xcoords = [];
|
968
|
+
this.current.ycoords = [];
|
930
969
|
}
|
931
970
|
|
932
971
|
setStrokeColorN(args) {
|
@@ -962,6 +1001,10 @@ exports.SVGGraphics = SVGGraphics;
|
|
962
1001
|
rect.setAttributeNS(null, "height", y1 - y0);
|
963
1002
|
rect.setAttributeNS(null, "fill", this._makeShadingPattern(args));
|
964
1003
|
|
1004
|
+
if (this.current.fillAlpha < 1) {
|
1005
|
+
rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha);
|
1006
|
+
}
|
1007
|
+
|
965
1008
|
this._ensureTransformGroup().appendChild(rect);
|
966
1009
|
}
|
967
1010
|
|
@@ -1376,19 +1419,6 @@ exports.SVGGraphics = SVGGraphics;
|
|
1376
1419
|
this._ensureTransformGroup().appendChild(rect);
|
1377
1420
|
}
|
1378
1421
|
|
1379
|
-
paintJpegXObject(objId, w, h) {
|
1380
|
-
const imgObj = this.objs.get(objId);
|
1381
|
-
const imgEl = this.svgFactory.createElement("svg:image");
|
1382
|
-
imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgObj.src);
|
1383
|
-
imgEl.setAttributeNS(null, "width", pf(w));
|
1384
|
-
imgEl.setAttributeNS(null, "height", pf(h));
|
1385
|
-
imgEl.setAttributeNS(null, "x", "0");
|
1386
|
-
imgEl.setAttributeNS(null, "y", pf(-h));
|
1387
|
-
imgEl.setAttributeNS(null, "transform", `scale(${pf(1 / w)} ${pf(-1 / h)})`);
|
1388
|
-
|
1389
|
-
this._ensureTransformGroup().appendChild(imgEl);
|
1390
|
-
}
|
1391
|
-
|
1392
1422
|
paintImageXObject(objId) {
|
1393
1423
|
const imgData = this.objs.get(objId);
|
1394
1424
|
|
@@ -102,7 +102,20 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
102
102
|
textDivProperties.angle = angle * (180 / Math.PI);
|
103
103
|
}
|
104
104
|
|
105
|
+
let shouldScaleText = false;
|
106
|
+
|
105
107
|
if (geom.str.length > 1) {
|
108
|
+
shouldScaleText = true;
|
109
|
+
} else if (geom.transform[0] !== geom.transform[3]) {
|
110
|
+
const absScaleX = Math.abs(geom.transform[0]),
|
111
|
+
absScaleY = Math.abs(geom.transform[3]);
|
112
|
+
|
113
|
+
if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) {
|
114
|
+
shouldScaleText = true;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
if (shouldScaleText) {
|
106
119
|
if (style.vertical) {
|
107
120
|
textDivProperties.canvasWidth = geom.height * task._viewport.scale;
|
108
121
|
} else {
|
@@ -173,6 +186,20 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
173
186
|
capability.resolve();
|
174
187
|
}
|
175
188
|
|
189
|
+
function findPositiveMin(ts, offset, count) {
|
190
|
+
let result = 0;
|
191
|
+
|
192
|
+
for (let i = 0; i < count; i++) {
|
193
|
+
const t = ts[offset++];
|
194
|
+
|
195
|
+
if (t > 0) {
|
196
|
+
result = result ? Math.min(t, result) : t;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
return result;
|
201
|
+
}
|
202
|
+
|
176
203
|
function expand(task) {
|
177
204
|
var bounds = task._bounds;
|
178
205
|
var viewport = task._viewport;
|
@@ -201,41 +228,26 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
201
228
|
s = m[1];
|
202
229
|
var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size];
|
203
230
|
var ts = new Float64Array(64);
|
204
|
-
points.forEach(function (p,
|
231
|
+
points.forEach(function (p, j) {
|
205
232
|
var t = _util.Util.applyTransform(p, m);
|
206
233
|
|
207
|
-
ts[
|
208
|
-
ts[
|
209
|
-
ts[
|
210
|
-
ts[
|
211
|
-
ts[
|
212
|
-
ts[
|
213
|
-
ts[
|
214
|
-
ts[
|
215
|
-
ts[
|
216
|
-
ts[
|
217
|
-
ts[
|
218
|
-
ts[
|
219
|
-
ts[
|
220
|
-
ts[
|
221
|
-
ts[
|
222
|
-
ts[
|
234
|
+
ts[j + 0] = c && (e.left - t[0]) / c;
|
235
|
+
ts[j + 4] = s && (e.top - t[1]) / s;
|
236
|
+
ts[j + 8] = c && (e.right - t[0]) / c;
|
237
|
+
ts[j + 12] = s && (e.bottom - t[1]) / s;
|
238
|
+
ts[j + 16] = s && (e.left - t[0]) / -s;
|
239
|
+
ts[j + 20] = c && (e.top - t[1]) / c;
|
240
|
+
ts[j + 24] = s && (e.right - t[0]) / -s;
|
241
|
+
ts[j + 28] = c && (e.bottom - t[1]) / c;
|
242
|
+
ts[j + 32] = c && (e.left - t[0]) / -c;
|
243
|
+
ts[j + 36] = s && (e.top - t[1]) / -s;
|
244
|
+
ts[j + 40] = c && (e.right - t[0]) / -c;
|
245
|
+
ts[j + 44] = s && (e.bottom - t[1]) / -s;
|
246
|
+
ts[j + 48] = s && (e.left - t[0]) / s;
|
247
|
+
ts[j + 52] = c && (e.top - t[1]) / -c;
|
248
|
+
ts[j + 56] = s && (e.right - t[0]) / s;
|
249
|
+
ts[j + 60] = c && (e.bottom - t[1]) / -c;
|
223
250
|
});
|
224
|
-
|
225
|
-
var findPositiveMin = function (ts, offset, count) {
|
226
|
-
var result = 0;
|
227
|
-
|
228
|
-
for (var i = 0; i < count; i++) {
|
229
|
-
var t = ts[offset++];
|
230
|
-
|
231
|
-
if (t > 0) {
|
232
|
-
result = result ? Math.min(t, result) : t;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
|
236
|
-
return result;
|
237
|
-
};
|
238
|
-
|
239
251
|
var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));
|
240
252
|
divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale;
|
241
253
|
divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale;
|
@@ -30,7 +30,7 @@ var _util = require("../shared/util.js");
|
|
30
30
|
|
31
31
|
class PDFDataTransportStream {
|
32
32
|
constructor(params, pdfDataRangeTransport) {
|
33
|
-
(0, _util.assert)(pdfDataRangeTransport);
|
33
|
+
(0, _util.assert)(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
|
34
34
|
this._queuedChunks = [];
|
35
35
|
this._progressiveDone = params.progressiveDone || false;
|
36
36
|
const initialData = params.initialData;
|
@@ -95,7 +95,7 @@ class PDFDataTransportStream {
|
|
95
95
|
return true;
|
96
96
|
});
|
97
97
|
|
98
|
-
(0, _util.assert)(found);
|
98
|
+
(0, _util.assert)(found, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
|
99
99
|
}
|
100
100
|
}
|
101
101
|
|
@@ -141,7 +141,7 @@ class PDFDataTransportStream {
|
|
141
141
|
}
|
142
142
|
|
143
143
|
getFullReader() {
|
144
|
-
(0, _util.assert)(!this._fullRequestReader);
|
144
|
+
(0, _util.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
|
145
145
|
const queuedChunks = this._queuedChunks;
|
146
146
|
this._queuedChunks = null;
|
147
147
|
return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone);
|
package/lib/pdf.js
CHANGED
@@ -21,25 +21,220 @@
|
|
21
21
|
*/
|
22
22
|
"use strict";
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
Object.defineProperty(exports, "__esModule", {
|
25
|
+
value: true
|
26
|
+
});
|
27
|
+
Object.defineProperty(exports, "addLinkAttributes", {
|
28
|
+
enumerable: true,
|
29
|
+
get: function () {
|
30
|
+
return _display_utils.addLinkAttributes;
|
31
|
+
}
|
32
|
+
});
|
33
|
+
Object.defineProperty(exports, "getFilenameFromUrl", {
|
34
|
+
enumerable: true,
|
35
|
+
get: function () {
|
36
|
+
return _display_utils.getFilenameFromUrl;
|
37
|
+
}
|
38
|
+
});
|
39
|
+
Object.defineProperty(exports, "LinkTarget", {
|
40
|
+
enumerable: true,
|
41
|
+
get: function () {
|
42
|
+
return _display_utils.LinkTarget;
|
43
|
+
}
|
44
|
+
});
|
45
|
+
Object.defineProperty(exports, "loadScript", {
|
46
|
+
enumerable: true,
|
47
|
+
get: function () {
|
48
|
+
return _display_utils.loadScript;
|
49
|
+
}
|
50
|
+
});
|
51
|
+
Object.defineProperty(exports, "PDFDateString", {
|
52
|
+
enumerable: true,
|
53
|
+
get: function () {
|
54
|
+
return _display_utils.PDFDateString;
|
55
|
+
}
|
56
|
+
});
|
57
|
+
Object.defineProperty(exports, "RenderingCancelledException", {
|
58
|
+
enumerable: true,
|
59
|
+
get: function () {
|
60
|
+
return _display_utils.RenderingCancelledException;
|
61
|
+
}
|
62
|
+
});
|
63
|
+
Object.defineProperty(exports, "build", {
|
64
|
+
enumerable: true,
|
65
|
+
get: function () {
|
66
|
+
return _api.build;
|
67
|
+
}
|
68
|
+
});
|
69
|
+
Object.defineProperty(exports, "getDocument", {
|
70
|
+
enumerable: true,
|
71
|
+
get: function () {
|
72
|
+
return _api.getDocument;
|
73
|
+
}
|
74
|
+
});
|
75
|
+
Object.defineProperty(exports, "LoopbackPort", {
|
76
|
+
enumerable: true,
|
77
|
+
get: function () {
|
78
|
+
return _api.LoopbackPort;
|
79
|
+
}
|
80
|
+
});
|
81
|
+
Object.defineProperty(exports, "PDFDataRangeTransport", {
|
82
|
+
enumerable: true,
|
83
|
+
get: function () {
|
84
|
+
return _api.PDFDataRangeTransport;
|
85
|
+
}
|
86
|
+
});
|
87
|
+
Object.defineProperty(exports, "PDFWorker", {
|
88
|
+
enumerable: true,
|
89
|
+
get: function () {
|
90
|
+
return _api.PDFWorker;
|
91
|
+
}
|
92
|
+
});
|
93
|
+
Object.defineProperty(exports, "version", {
|
94
|
+
enumerable: true,
|
95
|
+
get: function () {
|
96
|
+
return _api.version;
|
97
|
+
}
|
98
|
+
});
|
99
|
+
Object.defineProperty(exports, "CMapCompressionType", {
|
100
|
+
enumerable: true,
|
101
|
+
get: function () {
|
102
|
+
return _util.CMapCompressionType;
|
103
|
+
}
|
104
|
+
});
|
105
|
+
Object.defineProperty(exports, "createObjectURL", {
|
106
|
+
enumerable: true,
|
107
|
+
get: function () {
|
108
|
+
return _util.createObjectURL;
|
109
|
+
}
|
110
|
+
});
|
111
|
+
Object.defineProperty(exports, "createPromiseCapability", {
|
112
|
+
enumerable: true,
|
113
|
+
get: function () {
|
114
|
+
return _util.createPromiseCapability;
|
115
|
+
}
|
116
|
+
});
|
117
|
+
Object.defineProperty(exports, "createValidAbsoluteUrl", {
|
118
|
+
enumerable: true,
|
119
|
+
get: function () {
|
120
|
+
return _util.createValidAbsoluteUrl;
|
121
|
+
}
|
122
|
+
});
|
123
|
+
Object.defineProperty(exports, "InvalidPDFException", {
|
124
|
+
enumerable: true,
|
125
|
+
get: function () {
|
126
|
+
return _util.InvalidPDFException;
|
127
|
+
}
|
128
|
+
});
|
129
|
+
Object.defineProperty(exports, "MissingPDFException", {
|
130
|
+
enumerable: true,
|
131
|
+
get: function () {
|
132
|
+
return _util.MissingPDFException;
|
133
|
+
}
|
134
|
+
});
|
135
|
+
Object.defineProperty(exports, "OPS", {
|
136
|
+
enumerable: true,
|
137
|
+
get: function () {
|
138
|
+
return _util.OPS;
|
139
|
+
}
|
140
|
+
});
|
141
|
+
Object.defineProperty(exports, "PasswordResponses", {
|
142
|
+
enumerable: true,
|
143
|
+
get: function () {
|
144
|
+
return _util.PasswordResponses;
|
145
|
+
}
|
146
|
+
});
|
147
|
+
Object.defineProperty(exports, "PermissionFlag", {
|
148
|
+
enumerable: true,
|
149
|
+
get: function () {
|
150
|
+
return _util.PermissionFlag;
|
151
|
+
}
|
152
|
+
});
|
153
|
+
Object.defineProperty(exports, "removeNullCharacters", {
|
154
|
+
enumerable: true,
|
155
|
+
get: function () {
|
156
|
+
return _util.removeNullCharacters;
|
157
|
+
}
|
158
|
+
});
|
159
|
+
Object.defineProperty(exports, "shadow", {
|
160
|
+
enumerable: true,
|
161
|
+
get: function () {
|
162
|
+
return _util.shadow;
|
163
|
+
}
|
164
|
+
});
|
165
|
+
Object.defineProperty(exports, "UnexpectedResponseException", {
|
166
|
+
enumerable: true,
|
167
|
+
get: function () {
|
168
|
+
return _util.UnexpectedResponseException;
|
169
|
+
}
|
170
|
+
});
|
171
|
+
Object.defineProperty(exports, "UNSUPPORTED_FEATURES", {
|
172
|
+
enumerable: true,
|
173
|
+
get: function () {
|
174
|
+
return _util.UNSUPPORTED_FEATURES;
|
175
|
+
}
|
176
|
+
});
|
177
|
+
Object.defineProperty(exports, "Util", {
|
178
|
+
enumerable: true,
|
179
|
+
get: function () {
|
180
|
+
return _util.Util;
|
181
|
+
}
|
182
|
+
});
|
183
|
+
Object.defineProperty(exports, "VerbosityLevel", {
|
184
|
+
enumerable: true,
|
185
|
+
get: function () {
|
186
|
+
return _util.VerbosityLevel;
|
187
|
+
}
|
188
|
+
});
|
189
|
+
Object.defineProperty(exports, "AnnotationLayer", {
|
190
|
+
enumerable: true,
|
191
|
+
get: function () {
|
192
|
+
return _annotation_layer.AnnotationLayer;
|
193
|
+
}
|
194
|
+
});
|
195
|
+
Object.defineProperty(exports, "apiCompatibilityParams", {
|
196
|
+
enumerable: true,
|
197
|
+
get: function () {
|
198
|
+
return _api_compatibility.apiCompatibilityParams;
|
199
|
+
}
|
200
|
+
});
|
201
|
+
Object.defineProperty(exports, "GlobalWorkerOptions", {
|
202
|
+
enumerable: true,
|
203
|
+
get: function () {
|
204
|
+
return _worker_options.GlobalWorkerOptions;
|
205
|
+
}
|
206
|
+
});
|
207
|
+
Object.defineProperty(exports, "renderTextLayer", {
|
208
|
+
enumerable: true,
|
209
|
+
get: function () {
|
210
|
+
return _text_layer.renderTextLayer;
|
211
|
+
}
|
212
|
+
});
|
213
|
+
Object.defineProperty(exports, "SVGGraphics", {
|
214
|
+
enumerable: true,
|
215
|
+
get: function () {
|
216
|
+
return _svg.SVGGraphics;
|
217
|
+
}
|
218
|
+
});
|
26
219
|
|
27
|
-
var
|
220
|
+
var _display_utils = require("./display/display_utils.js");
|
28
221
|
|
29
|
-
var
|
222
|
+
var _api = require("./display/api.js");
|
30
223
|
|
31
|
-
var
|
224
|
+
var _util = require("./shared/util.js");
|
32
225
|
|
33
|
-
var
|
226
|
+
var _annotation_layer = require("./display/annotation_layer.js");
|
34
227
|
|
35
|
-
var
|
228
|
+
var _api_compatibility = require("./display/api_compatibility.js");
|
36
229
|
|
37
|
-
var
|
230
|
+
var _worker_options = require("./display/worker_options.js");
|
38
231
|
|
39
|
-
|
232
|
+
var _text_layer = require("./display/text_layer.js");
|
40
233
|
|
41
|
-
|
234
|
+
var _svg = require("./display/svg.js");
|
42
235
|
|
236
|
+
const pdfjsVersion = '2.5.207';
|
237
|
+
const pdfjsBuild = '0974d605';
|
43
238
|
{
|
44
239
|
const {
|
45
240
|
isNodeJS
|
@@ -48,7 +243,7 @@ const pdfjsDisplayAPICompatibility = require("./display/api_compatibility.js");
|
|
48
243
|
if (isNodeJS) {
|
49
244
|
const PDFNodeStream = require("./display/node_stream.js").PDFNodeStream;
|
50
245
|
|
51
|
-
|
246
|
+
(0, _api.setPDFNetworkStreamFactory)(params => {
|
52
247
|
return new PDFNodeStream(params);
|
53
248
|
});
|
54
249
|
} else {
|
@@ -56,49 +251,16 @@ const pdfjsDisplayAPICompatibility = require("./display/api_compatibility.js");
|
|
56
251
|
|
57
252
|
let PDFFetchStream;
|
58
253
|
|
59
|
-
if (
|
254
|
+
if ((0, _display_utils.isFetchSupported)()) {
|
60
255
|
PDFFetchStream = require("./display/fetch_stream.js").PDFFetchStream;
|
61
256
|
}
|
62
257
|
|
63
|
-
|
64
|
-
if (PDFFetchStream &&
|
258
|
+
(0, _api.setPDFNetworkStreamFactory)(params => {
|
259
|
+
if (PDFFetchStream && (0, _display_utils.isValidFetchUrl)(params.url)) {
|
65
260
|
return new PDFFetchStream(params);
|
66
261
|
}
|
67
262
|
|
68
263
|
return new PDFNetworkStream(params);
|
69
264
|
});
|
70
265
|
}
|
71
|
-
}
|
72
|
-
exports.build = pdfjsDisplayAPI.build;
|
73
|
-
exports.version = pdfjsDisplayAPI.version;
|
74
|
-
exports.getDocument = pdfjsDisplayAPI.getDocument;
|
75
|
-
exports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort;
|
76
|
-
exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport;
|
77
|
-
exports.PDFWorker = pdfjsDisplayAPI.PDFWorker;
|
78
|
-
exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer;
|
79
|
-
exports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer;
|
80
|
-
exports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability;
|
81
|
-
exports.PasswordResponses = pdfjsSharedUtil.PasswordResponses;
|
82
|
-
exports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException;
|
83
|
-
exports.MissingPDFException = pdfjsSharedUtil.MissingPDFException;
|
84
|
-
exports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics;
|
85
|
-
exports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding;
|
86
|
-
exports.CMapCompressionType = pdfjsSharedUtil.CMapCompressionType;
|
87
|
-
exports.PermissionFlag = pdfjsSharedUtil.PermissionFlag;
|
88
|
-
exports.UnexpectedResponseException = pdfjsSharedUtil.UnexpectedResponseException;
|
89
|
-
exports.OPS = pdfjsSharedUtil.OPS;
|
90
|
-
exports.VerbosityLevel = pdfjsSharedUtil.VerbosityLevel;
|
91
|
-
exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES;
|
92
|
-
exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl;
|
93
|
-
exports.createObjectURL = pdfjsSharedUtil.createObjectURL;
|
94
|
-
exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters;
|
95
|
-
exports.shadow = pdfjsSharedUtil.shadow;
|
96
|
-
exports.Util = pdfjsSharedUtil.Util;
|
97
|
-
exports.RenderingCancelledException = pdfjsDisplayDisplayUtils.RenderingCancelledException;
|
98
|
-
exports.getFilenameFromUrl = pdfjsDisplayDisplayUtils.getFilenameFromUrl;
|
99
|
-
exports.LinkTarget = pdfjsDisplayDisplayUtils.LinkTarget;
|
100
|
-
exports.addLinkAttributes = pdfjsDisplayDisplayUtils.addLinkAttributes;
|
101
|
-
exports.loadScript = pdfjsDisplayDisplayUtils.loadScript;
|
102
|
-
exports.PDFDateString = pdfjsDisplayDisplayUtils.PDFDateString;
|
103
|
-
exports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions;
|
104
|
-
exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityParams;
|
266
|
+
}
|
package/lib/pdf.worker.js
CHANGED
@@ -21,9 +21,17 @@
|
|
21
21
|
*/
|
22
22
|
"use strict";
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
Object.defineProperty(exports, "__esModule", {
|
25
|
+
value: true
|
26
|
+
});
|
27
|
+
Object.defineProperty(exports, "WorkerMessageHandler", {
|
28
|
+
enumerable: true,
|
29
|
+
get: function () {
|
30
|
+
return _worker.WorkerMessageHandler;
|
31
|
+
}
|
32
|
+
});
|
26
33
|
|
27
|
-
|
34
|
+
var _worker = require("./core/worker.js");
|
28
35
|
|
29
|
-
|
36
|
+
const pdfjsVersion = '2.5.207';
|
37
|
+
const pdfjsBuild = '0974d605';
|
package/lib/shared/is_node.js
CHANGED
@@ -25,5 +25,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
25
25
|
value: true
|
26
26
|
});
|
27
27
|
exports.isNodeJS = void 0;
|
28
|
-
const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions
|
28
|
+
const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron;
|
29
29
|
exports.isNodeJS = isNodeJS;
|
@@ -122,22 +122,22 @@ class MessageHandler {
|
|
122
122
|
}
|
123
123
|
|
124
124
|
if (data.callbackId) {
|
125
|
-
const
|
126
|
-
const
|
125
|
+
const cbSourceName = this.sourceName;
|
126
|
+
const cbTargetName = data.sourceName;
|
127
127
|
new Promise(function (resolve) {
|
128
128
|
resolve(action(data.data));
|
129
129
|
}).then(function (result) {
|
130
130
|
comObj.postMessage({
|
131
|
-
sourceName,
|
132
|
-
targetName,
|
131
|
+
sourceName: cbSourceName,
|
132
|
+
targetName: cbTargetName,
|
133
133
|
callback: CallbackKind.DATA,
|
134
134
|
callbackId: data.callbackId,
|
135
135
|
data: result
|
136
136
|
});
|
137
137
|
}, function (reason) {
|
138
138
|
comObj.postMessage({
|
139
|
-
sourceName,
|
140
|
-
targetName,
|
139
|
+
sourceName: cbSourceName,
|
140
|
+
targetName: cbTargetName,
|
141
141
|
callback: CallbackKind.ERROR,
|
142
142
|
callbackId: data.callbackId,
|
143
143
|
reason: wrapReason(reason)
|