pdfjs-dist 2.3.200 → 2.4.456
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/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +6499 -17971
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +22 -1
- package/build/pdf.worker.entry.js +5 -3
- package/build/pdf.worker.js +19303 -29896
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +25473 -0
- package/es5/build/pdf.js.map +1 -0
- package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
- package/es5/build/pdf.worker.js +57878 -0
- package/es5/build/pdf.worker.js.map +1 -0
- package/es5/web/images/annotation-check.svg +11 -0
- package/es5/web/images/annotation-comment.svg +16 -0
- package/es5/web/images/annotation-help.svg +26 -0
- package/es5/web/images/annotation-insert.svg +10 -0
- package/es5/web/images/annotation-key.svg +11 -0
- package/es5/web/images/annotation-newparagraph.svg +11 -0
- package/es5/web/images/annotation-noicon.svg +7 -0
- package/es5/web/images/annotation-note.svg +42 -0
- package/es5/web/images/annotation-paragraph.svg +16 -0
- package/es5/web/images/loading-icon.gif +0 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/images/texture.png +0 -0
- package/es5/web/pdf_viewer.css +407 -0
- package/es5/web/pdf_viewer.js +7757 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +1333 -4839
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +22 -1
- package/lib/README.md +7 -0
- package/lib/core/annotation.js +683 -1066
- package/lib/core/arithmetic_decoder.js +81 -97
- package/lib/core/bidi.js +54 -46
- package/lib/core/ccitt.js +88 -81
- package/lib/core/ccitt_stream.js +15 -14
- package/lib/core/cff_parser.js +196 -193
- package/lib/core/charsets.js +4 -4
- package/lib/core/chunked_stream.js +441 -569
- package/lib/core/cmap.js +220 -279
- package/lib/core/colorspace.js +699 -863
- package/lib/core/core_utils.js +59 -80
- package/lib/core/crypto.js +379 -437
- package/lib/core/document.js +564 -673
- package/lib/core/encodings.js +15 -15
- package/lib/core/evaluator.js +983 -889
- package/lib/core/font_renderer.js +128 -171
- package/lib/core/fonts.js +451 -400
- package/lib/core/function.js +289 -285
- package/lib/core/glyphlist.js +4527 -4527
- package/lib/core/image.js +138 -117
- package/lib/core/image_utils.js +46 -63
- package/lib/core/jbig2.js +324 -332
- package/lib/core/jbig2_stream.js +18 -17
- package/lib/core/jpeg_stream.js +133 -24
- package/lib/core/jpg.js +238 -210
- package/lib/core/jpx.js +158 -157
- package/lib/core/jpx_stream.js +28 -28
- package/lib/core/metrics.js +2928 -2928
- package/lib/core/murmurhash3.js +87 -102
- package/lib/core/obj.js +1111 -1302
- package/lib/core/operator_list.js +55 -42
- package/lib/core/parser.js +956 -987
- package/lib/core/pattern.js +69 -69
- package/lib/core/pdf_manager.js +149 -316
- package/lib/core/primitives.js +45 -77
- package/lib/core/ps_parser.js +175 -214
- package/lib/core/standard_fonts.js +237 -236
- package/lib/core/stream.js +83 -77
- package/lib/core/type1_parser.js +78 -68
- package/lib/core/unicode.js +1654 -1654
- package/lib/core/worker.js +148 -196
- package/lib/core/worker_stream.js +101 -210
- package/lib/display/annotation_layer.js +733 -1155
- package/lib/display/api.js +1539 -1928
- package/lib/display/api_compatibility.js +10 -8
- package/lib/display/canvas.js +159 -158
- package/lib/display/content_disposition.js +36 -55
- package/lib/display/display_utils.js +298 -551
- package/lib/display/fetch_stream.js +181 -305
- package/lib/display/font_loader.js +273 -416
- package/lib/display/metadata.js +86 -98
- package/lib/display/network.js +376 -511
- package/lib/display/network_utils.js +20 -19
- package/lib/display/node_stream.js +276 -460
- package/lib/display/pattern_helper.js +76 -44
- package/lib/display/svg.js +1137 -1405
- package/lib/display/text_layer.js +75 -82
- package/lib/display/transport_stream.js +236 -374
- package/lib/display/webgl.js +70 -83
- package/lib/display/worker_options.js +3 -3
- package/lib/display/xml_parser.js +303 -392
- package/lib/examples/node/domstubs.js +37 -37
- package/lib/pdf.js +22 -21
- package/lib/pdf.worker.js +5 -5
- package/lib/shared/compatibility.js +2 -251
- package/lib/shared/is_node.js +7 -6
- package/lib/shared/message_handler.js +222 -194
- package/lib/shared/util.js +269 -405
- package/lib/test/unit/annotation_spec.js +1089 -1014
- package/lib/test/unit/api_spec.js +617 -544
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +63 -62
- package/lib/test/unit/clitests_helper.js +7 -9
- package/lib/test/unit/cmap_spec.js +84 -86
- package/lib/test/unit/colorspace_spec.js +154 -154
- package/lib/test/unit/core_utils_spec.js +125 -105
- package/lib/test/unit/crypto_spec.js +181 -181
- package/lib/test/unit/custom_spec.js +22 -24
- package/lib/test/unit/display_svg_spec.js +35 -36
- package/lib/test/unit/display_utils_spec.js +139 -149
- package/lib/test/unit/document_spec.js +16 -16
- package/lib/test/unit/encodings_spec.js +12 -34
- package/lib/test/unit/evaluator_spec.js +81 -95
- package/lib/test/unit/fetch_stream_spec.js +30 -30
- package/lib/test/unit/function_spec.js +206 -204
- package/lib/test/unit/jasmine-boot.js +48 -32
- package/lib/test/unit/message_handler_spec.js +172 -162
- package/lib/test/unit/metadata_spec.js +69 -69
- package/lib/test/unit/murmurhash3_spec.js +12 -12
- package/lib/test/unit/network_spec.js +12 -12
- package/lib/test/unit/network_utils_spec.js +152 -152
- package/lib/test/unit/node_stream_spec.js +74 -90
- package/lib/test/unit/parser_spec.js +107 -113
- package/lib/test/unit/pdf_find_controller_spec.js +55 -86
- package/lib/test/unit/pdf_find_utils_spec.js +32 -32
- package/lib/test/unit/pdf_history_spec.js +32 -32
- package/lib/test/unit/primitives_spec.js +117 -115
- package/lib/test/unit/stream_spec.js +16 -14
- package/lib/test/unit/test_utils.js +119 -285
- package/lib/test/unit/testreporter.js +19 -19
- package/lib/test/unit/type1_parser_spec.js +41 -41
- package/lib/test/unit/ui_utils_spec.js +318 -426
- package/lib/test/unit/unicode_spec.js +42 -42
- package/lib/test/unit/util_spec.js +122 -143
- package/lib/web/annotation_layer_builder.js +66 -103
- package/lib/web/app.js +1166 -1196
- package/lib/web/app_options.js +61 -77
- package/lib/web/base_viewer.js +804 -850
- package/lib/web/chromecom.js +164 -249
- package/lib/web/debugger.js +149 -205
- package/lib/web/download_manager.js +38 -57
- package/lib/web/firefox_print_service.js +35 -30
- package/lib/web/firefoxcom.js +175 -374
- package/lib/web/genericcom.js +26 -108
- package/lib/web/genericl10n.js +24 -153
- package/lib/web/grab_to_pan.js +30 -30
- package/lib/web/interfaces.js +80 -258
- package/lib/web/overlay_manager.js +70 -246
- package/lib/web/password_prompt.js +38 -64
- package/lib/web/pdf_attachment_viewer.js +105 -130
- package/lib/web/pdf_cursor_tools.js +75 -102
- package/lib/web/pdf_document_properties.js +227 -376
- package/lib/web/pdf_find_bar.js +137 -171
- package/lib/web/pdf_find_controller.js +492 -549
- package/lib/web/pdf_find_utils.js +13 -13
- package/lib/web/pdf_history.js +395 -406
- package/lib/web/pdf_link_service.js +302 -349
- package/lib/web/pdf_outline_viewer.js +148 -209
- package/lib/web/pdf_page_view.js +449 -507
- package/lib/web/pdf_presentation_mode.js +304 -357
- package/lib/web/pdf_print_service.js +90 -104
- package/lib/web/pdf_rendering_queue.js +87 -108
- package/lib/web/pdf_sidebar.js +264 -304
- package/lib/web/pdf_sidebar_resizer.js +92 -119
- package/lib/web/pdf_single_page_viewer.js +77 -126
- package/lib/web/pdf_thumbnail_view.js +276 -297
- package/lib/web/pdf_thumbnail_viewer.js +186 -206
- package/lib/web/pdf_viewer.component.js +20 -21
- package/lib/web/pdf_viewer.js +55 -115
- package/lib/web/preferences.js +66 -273
- package/lib/web/secondary_toolbar.js +164 -196
- package/lib/web/text_layer_builder.js +284 -317
- package/lib/web/toolbar.js +216 -211
- package/lib/web/ui_utils.js +303 -404
- package/lib/web/view_history.js +49 -222
- package/lib/web/viewer_compatibility.js +7 -5
- package/package.json +2 -9
- package/web/pdf_viewer.css +25 -18
- package/web/pdf_viewer.js +3481 -4764
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +14 -5
- package/lib/shared/streams_polyfill.js +0 -43
package/lib/core/pattern.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2020 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -27,13 +27,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
27
27
|
exports.getTilingPatternIR = getTilingPatternIR;
|
28
28
|
exports.Pattern = void 0;
|
29
29
|
|
30
|
-
var _util = require("../shared/util");
|
30
|
+
var _util = require("../shared/util.js");
|
31
31
|
|
32
|
-
var _colorspace = require("./colorspace");
|
32
|
+
var _colorspace = require("./colorspace.js");
|
33
33
|
|
34
|
-
var _primitives = require("./primitives");
|
34
|
+
var _primitives = require("./primitives.js");
|
35
35
|
|
36
|
-
var _core_utils = require("./core_utils");
|
36
|
+
var _core_utils = require("./core_utils.js");
|
37
37
|
|
38
38
|
var ShadingType = {
|
39
39
|
FUNCTION_BASED: 1,
|
@@ -47,18 +47,18 @@ var ShadingType = {
|
|
47
47
|
|
48
48
|
var Pattern = function PatternClosure() {
|
49
49
|
function Pattern() {
|
50
|
-
(0, _util.unreachable)(
|
50
|
+
(0, _util.unreachable)("should not call Pattern constructor");
|
51
51
|
}
|
52
52
|
|
53
53
|
Pattern.prototype = {
|
54
54
|
getPattern: function Pattern_getPattern(ctx) {
|
55
|
-
(0, _util.unreachable)(
|
55
|
+
(0, _util.unreachable)(`Should not call Pattern.getStyle: ${ctx}`);
|
56
56
|
}
|
57
57
|
};
|
58
58
|
|
59
59
|
Pattern.parseShading = function (shading, matrix, xref, res, handler, pdfFunctionFactory) {
|
60
60
|
var dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
|
61
|
-
var type = dict.get(
|
61
|
+
var type = dict.get("ShadingType");
|
62
62
|
|
63
63
|
try {
|
64
64
|
switch (type) {
|
@@ -73,14 +73,14 @@ var Pattern = function PatternClosure() {
|
|
73
73
|
return new Shadings.Mesh(shading, matrix, xref, res, pdfFunctionFactory);
|
74
74
|
|
75
75
|
default:
|
76
|
-
throw new _util.FormatError(
|
76
|
+
throw new _util.FormatError("Unsupported ShadingType: " + type);
|
77
77
|
}
|
78
78
|
} catch (ex) {
|
79
79
|
if (ex instanceof _core_utils.MissingDataException) {
|
80
80
|
throw ex;
|
81
81
|
}
|
82
82
|
|
83
|
-
handler.send(
|
83
|
+
handler.send("UnsupportedFeature", {
|
84
84
|
featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
|
85
85
|
});
|
86
86
|
(0, _util.warn)(ex);
|
@@ -98,13 +98,13 @@ Shadings.SMALL_NUMBER = 1e-6;
|
|
98
98
|
Shadings.RadialAxial = function RadialAxialClosure() {
|
99
99
|
function RadialAxial(dict, matrix, xref, res, pdfFunctionFactory) {
|
100
100
|
this.matrix = matrix;
|
101
|
-
this.coordsArr = dict.getArray(
|
102
|
-
this.shadingType = dict.get(
|
103
|
-
this.type =
|
104
|
-
var cs = dict.get(
|
101
|
+
this.coordsArr = dict.getArray("Coords");
|
102
|
+
this.shadingType = dict.get("ShadingType");
|
103
|
+
this.type = "Pattern";
|
104
|
+
var cs = dict.get("ColorSpace", "CS");
|
105
105
|
cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
|
106
106
|
this.cs = cs;
|
107
|
-
|
107
|
+
const bbox = dict.getArray("BBox");
|
108
108
|
|
109
109
|
if (Array.isArray(bbox) && bbox.length === 4) {
|
110
110
|
this.bbox = _util.Util.normalizeRect(bbox);
|
@@ -115,8 +115,8 @@ Shadings.RadialAxial = function RadialAxialClosure() {
|
|
115
115
|
var t0 = 0.0,
|
116
116
|
t1 = 1.0;
|
117
117
|
|
118
|
-
if (dict.has(
|
119
|
-
var domainArr = dict.getArray(
|
118
|
+
if (dict.has("Domain")) {
|
119
|
+
var domainArr = dict.getArray("Domain");
|
120
120
|
t0 = domainArr[0];
|
121
121
|
t1 = domainArr[1];
|
122
122
|
}
|
@@ -124,8 +124,8 @@ Shadings.RadialAxial = function RadialAxialClosure() {
|
|
124
124
|
var extendStart = false,
|
125
125
|
extendEnd = false;
|
126
126
|
|
127
|
-
if (dict.has(
|
128
|
-
var extendArr = dict.getArray(
|
127
|
+
if (dict.has("Extend")) {
|
128
|
+
var extendArr = dict.getArray("Extend");
|
129
129
|
extendStart = extendArr[0];
|
130
130
|
extendEnd = extendArr[1];
|
131
131
|
}
|
@@ -140,20 +140,20 @@ Shadings.RadialAxial = function RadialAxialClosure() {
|
|
140
140
|
var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
|
141
141
|
|
142
142
|
if (r1 <= r2 + distance && r2 <= r1 + distance) {
|
143
|
-
(0, _util.warn)(
|
143
|
+
(0, _util.warn)("Unsupported radial gradient.");
|
144
144
|
}
|
145
145
|
}
|
146
146
|
|
147
147
|
this.extendStart = extendStart;
|
148
148
|
this.extendEnd = extendEnd;
|
149
|
-
var fnObj = dict.get(
|
149
|
+
var fnObj = dict.get("Function");
|
150
150
|
var fn = pdfFunctionFactory.createFromArray(fnObj);
|
151
|
-
|
152
|
-
|
151
|
+
const NUMBER_OF_SAMPLES = 10;
|
152
|
+
const step = (t1 - t0) / NUMBER_OF_SAMPLES;
|
153
153
|
var colorStops = this.colorStops = [];
|
154
154
|
|
155
155
|
if (t0 >= t1 || step <= 0) {
|
156
|
-
(0, _util.info)(
|
156
|
+
(0, _util.info)("Bad shading domain.");
|
157
157
|
return;
|
158
158
|
}
|
159
159
|
|
@@ -161,7 +161,7 @@ Shadings.RadialAxial = function RadialAxialClosure() {
|
|
161
161
|
ratio = new Float32Array(1);
|
162
162
|
var rgbColor;
|
163
163
|
|
164
|
-
for (
|
164
|
+
for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
|
165
165
|
ratio[0] = t0 + i * step;
|
166
166
|
fn(ratio, 0, color, 0);
|
167
167
|
rgbColor = cs.getRgb(color, 0);
|
@@ -171,10 +171,10 @@ Shadings.RadialAxial = function RadialAxialClosure() {
|
|
171
171
|
colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
|
172
172
|
}
|
173
173
|
|
174
|
-
var background =
|
174
|
+
var background = "transparent";
|
175
175
|
|
176
|
-
if (dict.has(
|
177
|
-
rgbColor = cs.getRgb(dict.get(
|
176
|
+
if (dict.has("Background")) {
|
177
|
+
rgbColor = cs.getRgb(dict.get("Background"), 0);
|
178
178
|
background = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
|
179
179
|
}
|
180
180
|
|
@@ -202,15 +202,15 @@ Shadings.RadialAxial = function RadialAxialClosure() {
|
|
202
202
|
p1 = [coordsArr[2], coordsArr[3]];
|
203
203
|
r0 = null;
|
204
204
|
r1 = null;
|
205
|
-
type =
|
205
|
+
type = "axial";
|
206
206
|
} else if (shadingType === ShadingType.RADIAL) {
|
207
207
|
p0 = [coordsArr[0], coordsArr[1]];
|
208
208
|
p1 = [coordsArr[3], coordsArr[4]];
|
209
209
|
r0 = coordsArr[2];
|
210
210
|
r1 = coordsArr[5];
|
211
|
-
type =
|
211
|
+
type = "radial";
|
212
212
|
} else {
|
213
|
-
(0, _util.unreachable)(
|
213
|
+
(0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
|
214
214
|
}
|
215
215
|
|
216
216
|
var matrix = this.matrix;
|
@@ -227,7 +227,7 @@ Shadings.RadialAxial = function RadialAxialClosure() {
|
|
227
227
|
}
|
228
228
|
}
|
229
229
|
|
230
|
-
return [
|
230
|
+
return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
|
231
231
|
}
|
232
232
|
};
|
233
233
|
return RadialAxial;
|
@@ -278,7 +278,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
278
278
|
buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
|
279
279
|
var nextByte = this.stream.getByte();
|
280
280
|
this.buffer = nextByte & (1 << bufferLength) - 1;
|
281
|
-
return (buffer << 8 - bufferLength | (nextByte &
|
281
|
+
return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
|
282
282
|
}
|
283
283
|
|
284
284
|
if (n === 8 && bufferLength === 0) {
|
@@ -346,7 +346,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
346
346
|
|
347
347
|
if (verticesLeft === 0) {
|
348
348
|
if (!(0 <= f && f <= 2)) {
|
349
|
-
throw new _util.FormatError(
|
349
|
+
throw new _util.FormatError("Unknown type4 flag");
|
350
350
|
}
|
351
351
|
|
352
352
|
switch (f) {
|
@@ -376,7 +376,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
376
376
|
}
|
377
377
|
|
378
378
|
mesh.figures.push({
|
379
|
-
type:
|
379
|
+
type: "triangles",
|
380
380
|
coords: new Int32Array(ps),
|
381
381
|
colors: new Int32Array(ps)
|
382
382
|
});
|
@@ -396,10 +396,10 @@ Shadings.Mesh = function MeshClosure() {
|
|
396
396
|
}
|
397
397
|
|
398
398
|
mesh.figures.push({
|
399
|
-
type:
|
399
|
+
type: "lattice",
|
400
400
|
coords: new Int32Array(ps),
|
401
401
|
colors: new Int32Array(ps),
|
402
|
-
verticesPerRow
|
402
|
+
verticesPerRow
|
403
403
|
});
|
404
404
|
}
|
405
405
|
|
@@ -432,7 +432,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
432
432
|
|
433
433
|
function buildFigureFromPatch(mesh, index) {
|
434
434
|
var figure = mesh.figures[index];
|
435
|
-
(0, _util.assert)(figure.type ===
|
435
|
+
(0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
|
436
436
|
var coords = mesh.coords,
|
437
437
|
colors = mesh.colors;
|
438
438
|
var pi = figure.coords;
|
@@ -503,10 +503,10 @@ Shadings.Mesh = function MeshClosure() {
|
|
503
503
|
figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
|
504
504
|
figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
|
505
505
|
mesh.figures[index] = {
|
506
|
-
type:
|
506
|
+
type: "lattice",
|
507
507
|
coords: figureCoords,
|
508
508
|
colors: figureColors,
|
509
|
-
verticesPerRow
|
509
|
+
verticesPerRow
|
510
510
|
};
|
511
511
|
}
|
512
512
|
|
@@ -520,7 +520,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
520
520
|
var f = reader.readFlag();
|
521
521
|
|
522
522
|
if (!(0 <= f && f <= 3)) {
|
523
|
-
throw new _util.FormatError(
|
523
|
+
throw new _util.FormatError("Unknown type6 flag");
|
524
524
|
}
|
525
525
|
|
526
526
|
var i, ii;
|
@@ -634,7 +634,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
634
634
|
ps[10] = coords.length;
|
635
635
|
coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
|
636
636
|
mesh.figures.push({
|
637
|
-
type:
|
637
|
+
type: "patch",
|
638
638
|
coords: new Int32Array(ps),
|
639
639
|
colors: new Int32Array(cs)
|
640
640
|
});
|
@@ -651,7 +651,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
651
651
|
var f = reader.readFlag();
|
652
652
|
|
653
653
|
if (!(0 <= f && f <= 3)) {
|
654
|
-
throw new _util.FormatError(
|
654
|
+
throw new _util.FormatError("Unknown type7 flag");
|
655
655
|
}
|
656
656
|
|
657
657
|
var i, ii;
|
@@ -773,7 +773,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
773
773
|
}
|
774
774
|
|
775
775
|
mesh.figures.push({
|
776
|
-
type:
|
776
|
+
type: "patch",
|
777
777
|
coords: new Int32Array(ps),
|
778
778
|
colors: new Int32Array(cs)
|
779
779
|
});
|
@@ -837,14 +837,14 @@ Shadings.Mesh = function MeshClosure() {
|
|
837
837
|
|
838
838
|
function Mesh(stream, matrix, xref, res, pdfFunctionFactory) {
|
839
839
|
if (!(0, _primitives.isStream)(stream)) {
|
840
|
-
throw new _util.FormatError(
|
840
|
+
throw new _util.FormatError("Mesh data is not a stream");
|
841
841
|
}
|
842
842
|
|
843
843
|
var dict = stream.dict;
|
844
844
|
this.matrix = matrix;
|
845
|
-
this.shadingType = dict.get(
|
846
|
-
this.type =
|
847
|
-
|
845
|
+
this.shadingType = dict.get("ShadingType");
|
846
|
+
this.type = "Pattern";
|
847
|
+
const bbox = dict.getArray("BBox");
|
848
848
|
|
849
849
|
if (Array.isArray(bbox) && bbox.length === 4) {
|
850
850
|
this.bbox = _util.Util.normalizeRect(bbox);
|
@@ -852,20 +852,20 @@ Shadings.Mesh = function MeshClosure() {
|
|
852
852
|
this.bbox = null;
|
853
853
|
}
|
854
854
|
|
855
|
-
var cs = dict.get(
|
855
|
+
var cs = dict.get("ColorSpace", "CS");
|
856
856
|
cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
|
857
857
|
this.cs = cs;
|
858
|
-
this.background = dict.has(
|
859
|
-
var fnObj = dict.get(
|
858
|
+
this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
|
859
|
+
var fnObj = dict.get("Function");
|
860
860
|
var fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
|
861
861
|
this.coords = [];
|
862
862
|
this.colors = [];
|
863
863
|
this.figures = [];
|
864
864
|
var decodeContext = {
|
865
|
-
bitsPerCoordinate: dict.get(
|
866
|
-
bitsPerComponent: dict.get(
|
867
|
-
bitsPerFlag: dict.get(
|
868
|
-
decode: dict.getArray(
|
865
|
+
bitsPerCoordinate: dict.get("BitsPerCoordinate"),
|
866
|
+
bitsPerComponent: dict.get("BitsPerComponent"),
|
867
|
+
bitsPerFlag: dict.get("BitsPerFlag"),
|
868
|
+
decode: dict.getArray("Decode"),
|
869
869
|
colorFn: fn,
|
870
870
|
colorSpace: cs,
|
871
871
|
numComps: fn ? 1 : cs.numComps
|
@@ -879,10 +879,10 @@ Shadings.Mesh = function MeshClosure() {
|
|
879
879
|
break;
|
880
880
|
|
881
881
|
case ShadingType.LATTICE_FORM_MESH:
|
882
|
-
var verticesPerRow = dict.get(
|
882
|
+
var verticesPerRow = dict.get("VerticesPerRow") | 0;
|
883
883
|
|
884
884
|
if (verticesPerRow < 2) {
|
885
|
-
throw new _util.FormatError(
|
885
|
+
throw new _util.FormatError("Invalid VerticesPerRow");
|
886
886
|
}
|
887
887
|
|
888
888
|
decodeType5Shading(this, reader, verticesPerRow);
|
@@ -899,7 +899,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
899
899
|
break;
|
900
900
|
|
901
901
|
default:
|
902
|
-
(0, _util.unreachable)(
|
902
|
+
(0, _util.unreachable)("Unsupported mesh type.");
|
903
903
|
break;
|
904
904
|
}
|
905
905
|
|
@@ -917,7 +917,7 @@ Shadings.Mesh = function MeshClosure() {
|
|
917
917
|
|
918
918
|
Mesh.prototype = {
|
919
919
|
getIR: function Mesh_getIR() {
|
920
|
-
return [
|
920
|
+
return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
|
921
921
|
}
|
922
922
|
};
|
923
923
|
return Mesh;
|
@@ -925,30 +925,30 @@ Shadings.Mesh = function MeshClosure() {
|
|
925
925
|
|
926
926
|
Shadings.Dummy = function DummyClosure() {
|
927
927
|
function Dummy() {
|
928
|
-
this.type =
|
928
|
+
this.type = "Pattern";
|
929
929
|
}
|
930
930
|
|
931
931
|
Dummy.prototype = {
|
932
932
|
getIR: function Dummy_getIR() {
|
933
|
-
return [
|
933
|
+
return ["Dummy"];
|
934
934
|
}
|
935
935
|
};
|
936
936
|
return Dummy;
|
937
937
|
}();
|
938
938
|
|
939
939
|
function getTilingPatternIR(operatorList, dict, args) {
|
940
|
-
|
940
|
+
const matrix = dict.getArray("Matrix");
|
941
941
|
|
942
|
-
|
942
|
+
const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
|
943
943
|
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
944
|
+
const xstep = dict.get("XStep");
|
945
|
+
const ystep = dict.get("YStep");
|
946
|
+
const paintType = dict.get("PaintType");
|
947
|
+
const tilingType = dict.get("TilingType");
|
948
948
|
|
949
949
|
if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
|
950
|
-
throw new _util.FormatError(
|
950
|
+
throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
|
951
951
|
}
|
952
952
|
|
953
|
-
return [
|
953
|
+
return ["TilingPattern", args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
|
954
954
|
}
|