pdfkit 0.12.0 → 0.13.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.
- package/CHANGELOG.md +69 -48
- package/LICENSE +7 -7
- package/README.md +182 -182
- package/js/data/Courier-Bold.afm +342 -342
- package/js/data/Courier-BoldOblique.afm +342 -342
- package/js/data/Courier-Oblique.afm +342 -342
- package/js/data/Courier.afm +342 -342
- package/js/data/Helvetica-Bold.afm +2827 -2827
- package/js/data/Helvetica-BoldOblique.afm +2827 -2827
- package/js/data/Helvetica-Oblique.afm +3051 -3051
- package/js/data/Helvetica.afm +3051 -3051
- package/js/data/Symbol.afm +213 -213
- package/js/data/Times-Bold.afm +2588 -2588
- package/js/data/Times-BoldItalic.afm +2384 -2384
- package/js/data/Times-Italic.afm +2667 -2667
- package/js/data/Times-Roman.afm +2419 -2419
- package/js/data/ZapfDingbats.afm +225 -225
- package/js/pdfkit.es5.js +416 -262
- package/js/pdfkit.es5.js.map +1 -1
- package/js/pdfkit.esnext.js +335 -205
- package/js/pdfkit.esnext.js.map +1 -1
- package/js/pdfkit.js +328 -201
- package/js/pdfkit.js.map +1 -1
- package/js/pdfkit.standalone.js +3438 -1990
- package/package.json +93 -94
- package/.prettierignore +0 -1
package/js/pdfkit.es5.js
CHANGED
|
@@ -7,6 +7,44 @@ import { EventEmitter } from 'events';
|
|
|
7
7
|
import LineBreaker from 'linebreak';
|
|
8
8
|
import PNG from 'png-js';
|
|
9
9
|
|
|
10
|
+
function ownKeys(object, enumerableOnly) {
|
|
11
|
+
var keys = Object.keys(object);
|
|
12
|
+
|
|
13
|
+
if (Object.getOwnPropertySymbols) {
|
|
14
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
15
|
+
|
|
16
|
+
if (enumerableOnly) {
|
|
17
|
+
symbols = symbols.filter(function (sym) {
|
|
18
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
keys.push.apply(keys, symbols);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return keys;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _objectSpread2(target) {
|
|
29
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
30
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
31
|
+
|
|
32
|
+
if (i % 2) {
|
|
33
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
34
|
+
_defineProperty(target, key, source[key]);
|
|
35
|
+
});
|
|
36
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
37
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
38
|
+
} else {
|
|
39
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
40
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return target;
|
|
46
|
+
}
|
|
47
|
+
|
|
10
48
|
function _classCallCheck(instance, Constructor) {
|
|
11
49
|
if (!(instance instanceof Constructor)) {
|
|
12
50
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -44,40 +82,6 @@ function _defineProperty(obj, key, value) {
|
|
|
44
82
|
return obj;
|
|
45
83
|
}
|
|
46
84
|
|
|
47
|
-
function ownKeys(object, enumerableOnly) {
|
|
48
|
-
var keys = Object.keys(object);
|
|
49
|
-
|
|
50
|
-
if (Object.getOwnPropertySymbols) {
|
|
51
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
52
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
53
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
54
|
-
});
|
|
55
|
-
keys.push.apply(keys, symbols);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return keys;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function _objectSpread2(target) {
|
|
62
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
63
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
64
|
-
|
|
65
|
-
if (i % 2) {
|
|
66
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
67
|
-
_defineProperty(target, key, source[key]);
|
|
68
|
-
});
|
|
69
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
70
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
71
|
-
} else {
|
|
72
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
73
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return target;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
85
|
function _inherits(subClass, superClass) {
|
|
82
86
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
83
87
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -115,7 +119,7 @@ function _isNativeReflectConstruct() {
|
|
|
115
119
|
if (typeof Proxy === "function") return true;
|
|
116
120
|
|
|
117
121
|
try {
|
|
118
|
-
|
|
122
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
119
123
|
return true;
|
|
120
124
|
} catch (e) {
|
|
121
125
|
return false;
|
|
@@ -174,18 +178,21 @@ function _arrayWithHoles(arr) {
|
|
|
174
178
|
}
|
|
175
179
|
|
|
176
180
|
function _iterableToArray(iter) {
|
|
177
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
181
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
178
182
|
}
|
|
179
183
|
|
|
180
184
|
function _iterableToArrayLimit(arr, i) {
|
|
181
|
-
|
|
185
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
186
|
+
|
|
187
|
+
if (_i == null) return;
|
|
182
188
|
var _arr = [];
|
|
183
189
|
var _n = true;
|
|
184
190
|
var _d = false;
|
|
185
|
-
|
|
191
|
+
|
|
192
|
+
var _s, _e;
|
|
186
193
|
|
|
187
194
|
try {
|
|
188
|
-
for (
|
|
195
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
189
196
|
_arr.push(_s.value);
|
|
190
197
|
|
|
191
198
|
if (i && _arr.length === i) break;
|
|
@@ -230,9 +237,9 @@ function _nonIterableRest() {
|
|
|
230
237
|
}
|
|
231
238
|
|
|
232
239
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
233
|
-
var it;
|
|
240
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
234
241
|
|
|
235
|
-
if (
|
|
242
|
+
if (!it) {
|
|
236
243
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
237
244
|
if (it) o = it;
|
|
238
245
|
var i = 0;
|
|
@@ -265,7 +272,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
265
272
|
err;
|
|
266
273
|
return {
|
|
267
274
|
s: function () {
|
|
268
|
-
it =
|
|
275
|
+
it = it.call(o);
|
|
269
276
|
},
|
|
270
277
|
n: function () {
|
|
271
278
|
var step = it.next();
|
|
@@ -286,8 +293,8 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
286
293
|
};
|
|
287
294
|
}
|
|
288
295
|
|
|
289
|
-
/*
|
|
290
|
-
PDFAbstractReference - abstract class for PDF reference
|
|
296
|
+
/*
|
|
297
|
+
PDFAbstractReference - abstract class for PDF reference
|
|
291
298
|
*/
|
|
292
299
|
var PDFAbstractReference = /*#__PURE__*/function () {
|
|
293
300
|
function PDFAbstractReference() {
|
|
@@ -364,9 +371,7 @@ var PDFTree = /*#__PURE__*/function () {
|
|
|
364
371
|
}
|
|
365
372
|
}, {
|
|
366
373
|
key: "_compareKeys",
|
|
367
|
-
value: function _compareKeys()
|
|
368
|
-
/*a, b*/
|
|
369
|
-
{
|
|
374
|
+
value: function _compareKeys() {
|
|
370
375
|
throw new Error('Must be implemented by subclasses');
|
|
371
376
|
}
|
|
372
377
|
}, {
|
|
@@ -376,9 +381,7 @@ var PDFTree = /*#__PURE__*/function () {
|
|
|
376
381
|
}
|
|
377
382
|
}, {
|
|
378
383
|
key: "_dataForKey",
|
|
379
|
-
value: function _dataForKey()
|
|
380
|
-
/*k*/
|
|
381
|
-
{
|
|
384
|
+
value: function _dataForKey() {
|
|
382
385
|
throw new Error('Must be implemented by subclasses');
|
|
383
386
|
}
|
|
384
387
|
}]);
|
|
@@ -616,9 +619,9 @@ var PDFReference = /*#__PURE__*/function (_PDFAbstractReference) {
|
|
|
616
619
|
return PDFReference;
|
|
617
620
|
}(PDFAbstractReference);
|
|
618
621
|
|
|
619
|
-
/*
|
|
620
|
-
PDFPage - represents a single page in the PDF document
|
|
621
|
-
By Devon Govett
|
|
622
|
+
/*
|
|
623
|
+
PDFPage - represents a single page in the PDF document
|
|
624
|
+
By Devon Govett
|
|
622
625
|
*/
|
|
623
626
|
var DEFAULT_MARGINS = {
|
|
624
627
|
top: 72,
|
|
@@ -722,23 +725,6 @@ var PDFPage = /*#__PURE__*/function () {
|
|
|
722
725
|
|
|
723
726
|
|
|
724
727
|
_createClass(PDFPage, [{
|
|
725
|
-
key: "maxY",
|
|
726
|
-
value: function maxY() {
|
|
727
|
-
return this.height - this.margins.bottom;
|
|
728
|
-
}
|
|
729
|
-
}, {
|
|
730
|
-
key: "write",
|
|
731
|
-
value: function write(chunk) {
|
|
732
|
-
return this.content.write(chunk);
|
|
733
|
-
}
|
|
734
|
-
}, {
|
|
735
|
-
key: "end",
|
|
736
|
-
value: function end() {
|
|
737
|
-
this.dictionary.end();
|
|
738
|
-
this.resources.end();
|
|
739
|
-
return this.content.end();
|
|
740
|
-
}
|
|
741
|
-
}, {
|
|
742
728
|
key: "fonts",
|
|
743
729
|
get: function get() {
|
|
744
730
|
var data = this.resources.data;
|
|
@@ -762,6 +748,12 @@ var PDFPage = /*#__PURE__*/function () {
|
|
|
762
748
|
var data = this.resources.data;
|
|
763
749
|
return data.Pattern != null ? data.Pattern : data.Pattern = {};
|
|
764
750
|
}
|
|
751
|
+
}, {
|
|
752
|
+
key: "colorSpaces",
|
|
753
|
+
get: function get() {
|
|
754
|
+
var data = this.resources.data;
|
|
755
|
+
return data.ColorSpace || (data.ColorSpace = {});
|
|
756
|
+
}
|
|
765
757
|
}, {
|
|
766
758
|
key: "annotations",
|
|
767
759
|
get: function get() {
|
|
@@ -774,6 +766,23 @@ var PDFPage = /*#__PURE__*/function () {
|
|
|
774
766
|
var data = this.dictionary.data;
|
|
775
767
|
return data.StructParents != null ? data.StructParents : data.StructParents = this.document.createStructParentTreeNextKey();
|
|
776
768
|
}
|
|
769
|
+
}, {
|
|
770
|
+
key: "maxY",
|
|
771
|
+
value: function maxY() {
|
|
772
|
+
return this.height - this.margins.bottom;
|
|
773
|
+
}
|
|
774
|
+
}, {
|
|
775
|
+
key: "write",
|
|
776
|
+
value: function write(chunk) {
|
|
777
|
+
return this.content.write(chunk);
|
|
778
|
+
}
|
|
779
|
+
}, {
|
|
780
|
+
key: "end",
|
|
781
|
+
value: function end() {
|
|
782
|
+
this.dictionary.end();
|
|
783
|
+
this.resources.end();
|
|
784
|
+
return this.content.end();
|
|
785
|
+
}
|
|
777
786
|
}]);
|
|
778
787
|
|
|
779
788
|
return PDFPage;
|
|
@@ -810,11 +819,11 @@ var PDFNameTree = /*#__PURE__*/function (_PDFTree) {
|
|
|
810
819
|
return PDFNameTree;
|
|
811
820
|
}(PDFTree);
|
|
812
821
|
|
|
813
|
-
/**
|
|
814
|
-
* Check if value is in a range group.
|
|
815
|
-
* @param {number} value
|
|
816
|
-
* @param {number[]} rangeGroup
|
|
817
|
-
* @returns {boolean}
|
|
822
|
+
/**
|
|
823
|
+
* Check if value is in a range group.
|
|
824
|
+
* @param {number} value
|
|
825
|
+
* @param {number[]} rangeGroup
|
|
826
|
+
* @returns {boolean}
|
|
818
827
|
*/
|
|
819
828
|
function inRange(value, rangeGroup) {
|
|
820
829
|
if (value < rangeGroup[0]) return false;
|
|
@@ -842,9 +851,9 @@ function inRange(value, rangeGroup) {
|
|
|
842
851
|
return false;
|
|
843
852
|
}
|
|
844
853
|
|
|
845
|
-
/**
|
|
846
|
-
* A.1 Unassigned code points in Unicode 3.2
|
|
847
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-A.1
|
|
854
|
+
/**
|
|
855
|
+
* A.1 Unassigned code points in Unicode 3.2
|
|
856
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-A.1
|
|
848
857
|
*/
|
|
849
858
|
|
|
850
859
|
var unassigned_code_points = [0x0221, 0x0221, 0x0234, 0x024f, 0x02ae, 0x02af, 0x02ef, 0x02ff, 0x0350, 0x035f, 0x0370, 0x0373, 0x0376, 0x0379, 0x037b, 0x037d, 0x037f, 0x0383, 0x038b, 0x038b, 0x038d, 0x038d, 0x03a2, 0x03a2, 0x03cf, 0x03cf, 0x03f7, 0x03ff, 0x0487, 0x0487, 0x04cf, 0x04cf, 0x04f6, 0x04f7, 0x04fa, 0x04ff, 0x0510, 0x0530, 0x0557, 0x0558, 0x0560, 0x0560, 0x0588, 0x0588, 0x058b, 0x0590, 0x05a2, 0x05a2, 0x05ba, 0x05ba, 0x05c5, 0x05cf, 0x05eb, 0x05ef, 0x05f5, 0x060b, 0x060d, 0x061a, 0x061c, 0x061e, 0x0620, 0x0620, 0x063b, 0x063f, 0x0656, 0x065f, 0x06ee, 0x06ef, 0x06ff, 0x06ff, 0x070e, 0x070e, 0x072d, 0x072f, 0x074b, 0x077f, 0x07b2, 0x0900, 0x0904, 0x0904, 0x093a, 0x093b, 0x094e, 0x094f, 0x0955, 0x0957, 0x0971, 0x0980, 0x0984, 0x0984, 0x098d, 0x098e, 0x0991, 0x0992, 0x09a9, 0x09a9, 0x09b1, 0x09b1, 0x09b3, 0x09b5, 0x09ba, 0x09bb, 0x09bd, 0x09bd, 0x09c5, 0x09c6, 0x09c9, 0x09ca, 0x09ce, 0x09d6, 0x09d8, 0x09db, 0x09de, 0x09de, 0x09e4, 0x09e5, 0x09fb, 0x0a01, 0x0a03, 0x0a04, 0x0a0b, 0x0a0e, 0x0a11, 0x0a12, 0x0a29, 0x0a29, 0x0a31, 0x0a31, 0x0a34, 0x0a34, 0x0a37, 0x0a37, 0x0a3a, 0x0a3b, 0x0a3d, 0x0a3d, 0x0a43, 0x0a46, 0x0a49, 0x0a4a, 0x0a4e, 0x0a58, 0x0a5d, 0x0a5d, 0x0a5f, 0x0a65, 0x0a75, 0x0a80, 0x0a84, 0x0a84, 0x0a8c, 0x0a8c, 0x0a8e, 0x0a8e, 0x0a92, 0x0a92, 0x0aa9, 0x0aa9, 0x0ab1, 0x0ab1, 0x0ab4, 0x0ab4, 0x0aba, 0x0abb, 0x0ac6, 0x0ac6, 0x0aca, 0x0aca, 0x0ace, 0x0acf, 0x0ad1, 0x0adf, 0x0ae1, 0x0ae5, 0x0af0, 0x0b00, 0x0b04, 0x0b04, 0x0b0d, 0x0b0e, 0x0b11, 0x0b12, 0x0b29, 0x0b29, 0x0b31, 0x0b31, 0x0b34, 0x0b35, 0x0b3a, 0x0b3b, 0x0b44, 0x0b46, 0x0b49, 0x0b4a, 0x0b4e, 0x0b55, 0x0b58, 0x0b5b, 0x0b5e, 0x0b5e, 0x0b62, 0x0b65, 0x0b71, 0x0b81, 0x0b84, 0x0b84, 0x0b8b, 0x0b8d, 0x0b91, 0x0b91, 0x0b96, 0x0b98, 0x0b9b, 0x0b9b, 0x0b9d, 0x0b9d, 0x0ba0, 0x0ba2, 0x0ba5, 0x0ba7, 0x0bab, 0x0bad, 0x0bb6, 0x0bb6, 0x0bba, 0x0bbd, 0x0bc3, 0x0bc5, 0x0bc9, 0x0bc9, 0x0bce, 0x0bd6, 0x0bd8, 0x0be6, 0x0bf3, 0x0c00, 0x0c04, 0x0c04, 0x0c0d, 0x0c0d, 0x0c11, 0x0c11, 0x0c29, 0x0c29, 0x0c34, 0x0c34, 0x0c3a, 0x0c3d, 0x0c45, 0x0c45, 0x0c49, 0x0c49, 0x0c4e, 0x0c54, 0x0c57, 0x0c5f, 0x0c62, 0x0c65, 0x0c70, 0x0c81, 0x0c84, 0x0c84, 0x0c8d, 0x0c8d, 0x0c91, 0x0c91, 0x0ca9, 0x0ca9, 0x0cb4, 0x0cb4, 0x0cba, 0x0cbd, 0x0cc5, 0x0cc5, 0x0cc9, 0x0cc9, 0x0cce, 0x0cd4, 0x0cd7, 0x0cdd, 0x0cdf, 0x0cdf, 0x0ce2, 0x0ce5, 0x0cf0, 0x0d01, 0x0d04, 0x0d04, 0x0d0d, 0x0d0d, 0x0d11, 0x0d11, 0x0d29, 0x0d29, 0x0d3a, 0x0d3d, 0x0d44, 0x0d45, 0x0d49, 0x0d49, 0x0d4e, 0x0d56, 0x0d58, 0x0d5f, 0x0d62, 0x0d65, 0x0d70, 0x0d81, 0x0d84, 0x0d84, 0x0d97, 0x0d99, 0x0db2, 0x0db2, 0x0dbc, 0x0dbc, 0x0dbe, 0x0dbf, 0x0dc7, 0x0dc9, 0x0dcb, 0x0dce, 0x0dd5, 0x0dd5, 0x0dd7, 0x0dd7, 0x0de0, 0x0df1, 0x0df5, 0x0e00, 0x0e3b, 0x0e3e, 0x0e5c, 0x0e80, 0x0e83, 0x0e83, 0x0e85, 0x0e86, 0x0e89, 0x0e89, 0x0e8b, 0x0e8c, 0x0e8e, 0x0e93, 0x0e98, 0x0e98, 0x0ea0, 0x0ea0, 0x0ea4, 0x0ea4, 0x0ea6, 0x0ea6, 0x0ea8, 0x0ea9, 0x0eac, 0x0eac, 0x0eba, 0x0eba, 0x0ebe, 0x0ebf, 0x0ec5, 0x0ec5, 0x0ec7, 0x0ec7, 0x0ece, 0x0ecf, 0x0eda, 0x0edb, 0x0ede, 0x0eff, 0x0f48, 0x0f48, 0x0f6b, 0x0f70, 0x0f8c, 0x0f8f, 0x0f98, 0x0f98, 0x0fbd, 0x0fbd, 0x0fcd, 0x0fce, 0x0fd0, 0x0fff, 0x1022, 0x1022, 0x1028, 0x1028, 0x102b, 0x102b, 0x1033, 0x1035, 0x103a, 0x103f, 0x105a, 0x109f, 0x10c6, 0x10cf, 0x10f9, 0x10fa, 0x10fc, 0x10ff, 0x115a, 0x115e, 0x11a3, 0x11a7, 0x11fa, 0x11ff, 0x1207, 0x1207, 0x1247, 0x1247, 0x1249, 0x1249, 0x124e, 0x124f, 0x1257, 0x1257, 0x1259, 0x1259, 0x125e, 0x125f, 0x1287, 0x1287, 0x1289, 0x1289, 0x128e, 0x128f, 0x12af, 0x12af, 0x12b1, 0x12b1, 0x12b6, 0x12b7, 0x12bf, 0x12bf, 0x12c1, 0x12c1, 0x12c6, 0x12c7, 0x12cf, 0x12cf, 0x12d7, 0x12d7, 0x12ef, 0x12ef, 0x130f, 0x130f, 0x1311, 0x1311, 0x1316, 0x1317, 0x131f, 0x131f, 0x1347, 0x1347, 0x135b, 0x1360, 0x137d, 0x139f, 0x13f5, 0x1400, 0x1677, 0x167f, 0x169d, 0x169f, 0x16f1, 0x16ff, 0x170d, 0x170d, 0x1715, 0x171f, 0x1737, 0x173f, 0x1754, 0x175f, 0x176d, 0x176d, 0x1771, 0x1771, 0x1774, 0x177f, 0x17dd, 0x17df, 0x17ea, 0x17ff, 0x180f, 0x180f, 0x181a, 0x181f, 0x1878, 0x187f, 0x18aa, 0x1dff, 0x1e9c, 0x1e9f, 0x1efa, 0x1eff, 0x1f16, 0x1f17, 0x1f1e, 0x1f1f, 0x1f46, 0x1f47, 0x1f4e, 0x1f4f, 0x1f58, 0x1f58, 0x1f5a, 0x1f5a, 0x1f5c, 0x1f5c, 0x1f5e, 0x1f5e, 0x1f7e, 0x1f7f, 0x1fb5, 0x1fb5, 0x1fc5, 0x1fc5, 0x1fd4, 0x1fd5, 0x1fdc, 0x1fdc, 0x1ff0, 0x1ff1, 0x1ff5, 0x1ff5, 0x1fff, 0x1fff, 0x2053, 0x2056, 0x2058, 0x205e, 0x2064, 0x2069, 0x2072, 0x2073, 0x208f, 0x209f, 0x20b2, 0x20cf, 0x20eb, 0x20ff, 0x213b, 0x213c, 0x214c, 0x2152, 0x2184, 0x218f, 0x23cf, 0x23ff, 0x2427, 0x243f, 0x244b, 0x245f, 0x24ff, 0x24ff, 0x2614, 0x2615, 0x2618, 0x2618, 0x267e, 0x267f, 0x268a, 0x2700, 0x2705, 0x2705, 0x270a, 0x270b, 0x2728, 0x2728, 0x274c, 0x274c, 0x274e, 0x274e, 0x2753, 0x2755, 0x2757, 0x2757, 0x275f, 0x2760, 0x2795, 0x2797, 0x27b0, 0x27b0, 0x27bf, 0x27cf, 0x27ec, 0x27ef, 0x2b00, 0x2e7f, 0x2e9a, 0x2e9a, 0x2ef4, 0x2eff, 0x2fd6, 0x2fef, 0x2ffc, 0x2fff, 0x3040, 0x3040, 0x3097, 0x3098, 0x3100, 0x3104, 0x312d, 0x3130, 0x318f, 0x318f, 0x31b8, 0x31ef, 0x321d, 0x321f, 0x3244, 0x3250, 0x327c, 0x327e, 0x32cc, 0x32cf, 0x32ff, 0x32ff, 0x3377, 0x337a, 0x33de, 0x33df, 0x33ff, 0x33ff, 0x4db6, 0x4dff, 0x9fa6, 0x9fff, 0xa48d, 0xa48f, 0xa4c7, 0xabff, 0xd7a4, 0xd7ff, 0xfa2e, 0xfa2f, 0xfa6b, 0xfaff, 0xfb07, 0xfb12, 0xfb18, 0xfb1c, 0xfb37, 0xfb37, 0xfb3d, 0xfb3d, 0xfb3f, 0xfb3f, 0xfb42, 0xfb42, 0xfb45, 0xfb45, 0xfbb2, 0xfbd2, 0xfd40, 0xfd4f, 0xfd90, 0xfd91, 0xfdc8, 0xfdcf, 0xfdfd, 0xfdff, 0xfe10, 0xfe1f, 0xfe24, 0xfe2f, 0xfe47, 0xfe48, 0xfe53, 0xfe53, 0xfe67, 0xfe67, 0xfe6c, 0xfe6f, 0xfe75, 0xfe75, 0xfefd, 0xfefe, 0xff00, 0xff00, 0xffbf, 0xffc1, 0xffc8, 0xffc9, 0xffd0, 0xffd1, 0xffd8, 0xffd9, 0xffdd, 0xffdf, 0xffe7, 0xffe7, 0xffef, 0xfff8, 0x10000, 0x102ff, 0x1031f, 0x1031f, 0x10324, 0x1032f, 0x1034b, 0x103ff, 0x10426, 0x10427, 0x1044e, 0x1cfff, 0x1d0f6, 0x1d0ff, 0x1d127, 0x1d129, 0x1d1de, 0x1d3ff, 0x1d455, 0x1d455, 0x1d49d, 0x1d49d, 0x1d4a0, 0x1d4a1, 0x1d4a3, 0x1d4a4, 0x1d4a7, 0x1d4a8, 0x1d4ad, 0x1d4ad, 0x1d4ba, 0x1d4ba, 0x1d4bc, 0x1d4bc, 0x1d4c1, 0x1d4c1, 0x1d4c4, 0x1d4c4, 0x1d506, 0x1d506, 0x1d50b, 0x1d50c, 0x1d515, 0x1d515, 0x1d51d, 0x1d51d, 0x1d53a, 0x1d53a, 0x1d53f, 0x1d53f, 0x1d545, 0x1d545, 0x1d547, 0x1d549, 0x1d551, 0x1d551, 0x1d6a4, 0x1d6a7, 0x1d7ca, 0x1d7cd, 0x1d800, 0x1fffd, 0x2a6d7, 0x2f7ff, 0x2fa1e, 0x2fffd, 0x30000, 0x3fffd, 0x40000, 0x4fffd, 0x50000, 0x5fffd, 0x60000, 0x6fffd, 0x70000, 0x7fffd, 0x80000, 0x8fffd, 0x90000, 0x9fffd, 0xa0000, 0xafffd, 0xb0000, 0xbfffd, 0xc0000, 0xcfffd, 0xd0000, 0xdfffd, 0xe0000, 0xe0000, 0xe0002, 0xe001f, 0xe0080, 0xefffd]; // prettier-ignore-end
|
|
@@ -853,9 +862,9 @@ var isUnassignedCodePoint = function isUnassignedCodePoint(character) {
|
|
|
853
862
|
return inRange(character, unassigned_code_points);
|
|
854
863
|
}; // prettier-ignore-start
|
|
855
864
|
|
|
856
|
-
/**
|
|
857
|
-
* B.1 Commonly mapped to nothing
|
|
858
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-B.1
|
|
865
|
+
/**
|
|
866
|
+
* B.1 Commonly mapped to nothing
|
|
867
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-B.1
|
|
859
868
|
*/
|
|
860
869
|
|
|
861
870
|
|
|
@@ -865,9 +874,9 @@ var isCommonlyMappedToNothing = function isCommonlyMappedToNothing(character) {
|
|
|
865
874
|
return inRange(character, commonly_mapped_to_nothing);
|
|
866
875
|
}; // prettier-ignore-start
|
|
867
876
|
|
|
868
|
-
/**
|
|
869
|
-
* C.1.2 Non-ASCII space characters
|
|
870
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2
|
|
877
|
+
/**
|
|
878
|
+
* C.1.2 Non-ASCII space characters
|
|
879
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2
|
|
871
880
|
*/
|
|
872
881
|
|
|
873
882
|
|
|
@@ -913,9 +922,9 @@ var isNonASCIISpaceCharacter = function isNonASCIISpaceCharacter(character) {
|
|
|
913
922
|
|
|
914
923
|
|
|
915
924
|
var non_ASCII_controls_characters = [
|
|
916
|
-
/**
|
|
917
|
-
* C.2.2 Non-ASCII control characters
|
|
918
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2
|
|
925
|
+
/**
|
|
926
|
+
* C.2.2 Non-ASCII control characters
|
|
927
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2
|
|
919
928
|
*/
|
|
920
929
|
0x0080, 0x009f
|
|
921
930
|
/* [CONTROL CHARACTERS] */
|
|
@@ -951,9 +960,9 @@ var non_ASCII_controls_characters = [
|
|
|
951
960
|
/* [MUSICAL CONTROL CHARACTERS] */
|
|
952
961
|
];
|
|
953
962
|
var non_character_codepoints = [
|
|
954
|
-
/**
|
|
955
|
-
* C.4 Non-character code points
|
|
956
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.4
|
|
963
|
+
/**
|
|
964
|
+
* C.4 Non-character code points
|
|
965
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.4
|
|
957
966
|
*/
|
|
958
967
|
0xfdd0, 0xfdef
|
|
959
968
|
/* [NONCHARACTER CODE POINTS] */
|
|
@@ -990,23 +999,23 @@ var non_character_codepoints = [
|
|
|
990
999
|
, 0x10fffe, 0x10ffff
|
|
991
1000
|
/* [NONCHARACTER CODE POINTS] */
|
|
992
1001
|
];
|
|
993
|
-
/**
|
|
994
|
-
* 2.3. Prohibited Output
|
|
1002
|
+
/**
|
|
1003
|
+
* 2.3. Prohibited Output
|
|
995
1004
|
*/
|
|
996
1005
|
|
|
997
1006
|
var prohibited_characters = [
|
|
998
|
-
/**
|
|
999
|
-
* C.2.1 ASCII control characters
|
|
1000
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1
|
|
1007
|
+
/**
|
|
1008
|
+
* C.2.1 ASCII control characters
|
|
1009
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1
|
|
1001
1010
|
*/
|
|
1002
1011
|
0, 0x001f
|
|
1003
1012
|
/* [CONTROL CHARACTERS] */
|
|
1004
1013
|
, 0x007f, 0x007f
|
|
1005
1014
|
/* DELETE */
|
|
1006
1015
|
,
|
|
1007
|
-
/**
|
|
1008
|
-
* C.8 Change display properties or are deprecated
|
|
1009
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.8
|
|
1016
|
+
/**
|
|
1017
|
+
* C.8 Change display properties or are deprecated
|
|
1018
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.8
|
|
1010
1019
|
*/
|
|
1011
1020
|
0x0340, 0x0340
|
|
1012
1021
|
/* COMBINING GRAVE TONE MARK */
|
|
@@ -1039,28 +1048,28 @@ var prohibited_characters = [
|
|
|
1039
1048
|
, 0x206f, 0x206f
|
|
1040
1049
|
/* NOMINAL DIGIT SHAPES */
|
|
1041
1050
|
,
|
|
1042
|
-
/**
|
|
1043
|
-
* C.7 Inappropriate for canonical representation
|
|
1044
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.7
|
|
1051
|
+
/**
|
|
1052
|
+
* C.7 Inappropriate for canonical representation
|
|
1053
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.7
|
|
1045
1054
|
*/
|
|
1046
1055
|
0x2ff0, 0x2ffb
|
|
1047
1056
|
/* [IDEOGRAPHIC DESCRIPTION CHARACTERS] */
|
|
1048
1057
|
,
|
|
1049
|
-
/**
|
|
1050
|
-
* C.5 Surrogate codes
|
|
1051
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.5
|
|
1058
|
+
/**
|
|
1059
|
+
* C.5 Surrogate codes
|
|
1060
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.5
|
|
1052
1061
|
*/
|
|
1053
1062
|
0xd800, 0xdfff,
|
|
1054
|
-
/**
|
|
1055
|
-
* C.3 Private use
|
|
1056
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
1063
|
+
/**
|
|
1064
|
+
* C.3 Private use
|
|
1065
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
1057
1066
|
*/
|
|
1058
1067
|
0xe000, 0xf8ff
|
|
1059
1068
|
/* [PRIVATE USE, PLANE 0] */
|
|
1060
1069
|
,
|
|
1061
|
-
/**
|
|
1062
|
-
* C.6 Inappropriate for plain text
|
|
1063
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.6
|
|
1070
|
+
/**
|
|
1071
|
+
* C.6 Inappropriate for plain text
|
|
1072
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.6
|
|
1064
1073
|
*/
|
|
1065
1074
|
0xfff9, 0xfff9
|
|
1066
1075
|
/* INTERLINEAR ANNOTATION ANCHOR */
|
|
@@ -1073,18 +1082,18 @@ var prohibited_characters = [
|
|
|
1073
1082
|
, 0xfffd, 0xfffd
|
|
1074
1083
|
/* REPLACEMENT CHARACTER */
|
|
1075
1084
|
,
|
|
1076
|
-
/**
|
|
1077
|
-
* C.9 Tagging characters
|
|
1078
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.9
|
|
1085
|
+
/**
|
|
1086
|
+
* C.9 Tagging characters
|
|
1087
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.9
|
|
1079
1088
|
*/
|
|
1080
1089
|
0xe0001, 0xe0001
|
|
1081
1090
|
/* LANGUAGE TAG */
|
|
1082
1091
|
, 0xe0020, 0xe007f
|
|
1083
1092
|
/* [TAGGING CHARACTERS] */
|
|
1084
1093
|
,
|
|
1085
|
-
/**
|
|
1086
|
-
* C.3 Private use
|
|
1087
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
1094
|
+
/**
|
|
1095
|
+
* C.3 Private use
|
|
1096
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
1088
1097
|
*/
|
|
1089
1098
|
0xf0000, 0xffffd
|
|
1090
1099
|
/* [PRIVATE USE, PLANE 15] */
|
|
@@ -1096,9 +1105,9 @@ var isProhibitedCharacter = function isProhibitedCharacter(character) {
|
|
|
1096
1105
|
return inRange(character, non_ASCII_space_characters) || inRange(character, prohibited_characters) || inRange(character, non_ASCII_controls_characters) || inRange(character, non_character_codepoints);
|
|
1097
1106
|
}; // prettier-ignore-start
|
|
1098
1107
|
|
|
1099
|
-
/**
|
|
1100
|
-
* D.1 Characters with bidirectional property "R" or "AL"
|
|
1101
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-D.1
|
|
1108
|
+
/**
|
|
1109
|
+
* D.1 Characters with bidirectional property "R" or "AL"
|
|
1110
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-D.1
|
|
1102
1111
|
*/
|
|
1103
1112
|
|
|
1104
1113
|
|
|
@@ -1108,9 +1117,9 @@ var isBidirectionalRAL = function isBidirectionalRAL(character) {
|
|
|
1108
1117
|
return inRange(character, bidirectional_r_al);
|
|
1109
1118
|
}; // prettier-ignore-start
|
|
1110
1119
|
|
|
1111
|
-
/**
|
|
1112
|
-
* D.2 Characters with bidirectional property "L"
|
|
1113
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-D.2
|
|
1120
|
+
/**
|
|
1121
|
+
* D.2 Characters with bidirectional property "L"
|
|
1122
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-D.2
|
|
1114
1123
|
*/
|
|
1115
1124
|
|
|
1116
1125
|
|
|
@@ -1120,15 +1129,15 @@ var isBidirectionalL = function isBidirectionalL(character) {
|
|
|
1120
1129
|
return inRange(character, bidirectional_l);
|
|
1121
1130
|
};
|
|
1122
1131
|
|
|
1123
|
-
/**
|
|
1124
|
-
* non-ASCII space characters [StringPrep, C.1.2] that can be
|
|
1125
|
-
* mapped to SPACE (U+0020)
|
|
1132
|
+
/**
|
|
1133
|
+
* non-ASCII space characters [StringPrep, C.1.2] that can be
|
|
1134
|
+
* mapped to SPACE (U+0020)
|
|
1126
1135
|
*/
|
|
1127
1136
|
|
|
1128
1137
|
var mapping2space = isNonASCIISpaceCharacter;
|
|
1129
|
-
/**
|
|
1130
|
-
* the "commonly mapped to nothing" characters [StringPrep, B.1]
|
|
1131
|
-
* that can be mapped to nothing.
|
|
1138
|
+
/**
|
|
1139
|
+
* the "commonly mapped to nothing" characters [StringPrep, B.1]
|
|
1140
|
+
* that can be mapped to nothing.
|
|
1132
1141
|
*/
|
|
1133
1142
|
|
|
1134
1143
|
var mapping2nothing = isCommonlyMappedToNothing; // utils
|
|
@@ -1144,12 +1153,12 @@ var first = function first(x) {
|
|
|
1144
1153
|
var last = function last(x) {
|
|
1145
1154
|
return x[x.length - 1];
|
|
1146
1155
|
};
|
|
1147
|
-
/**
|
|
1148
|
-
* Convert provided string into an array of Unicode Code Points.
|
|
1149
|
-
* Based on https://stackoverflow.com/a/21409165/1556249
|
|
1150
|
-
* and https://www.npmjs.com/package/code-point-at.
|
|
1151
|
-
* @param {string} input
|
|
1152
|
-
* @returns {number[]}
|
|
1156
|
+
/**
|
|
1157
|
+
* Convert provided string into an array of Unicode Code Points.
|
|
1158
|
+
* Based on https://stackoverflow.com/a/21409165/1556249
|
|
1159
|
+
* and https://www.npmjs.com/package/code-point-at.
|
|
1160
|
+
* @param {string} input
|
|
1161
|
+
* @returns {number[]}
|
|
1153
1162
|
*/
|
|
1154
1163
|
|
|
1155
1164
|
|
|
@@ -1175,12 +1184,12 @@ function toCodePoints(input) {
|
|
|
1175
1184
|
|
|
1176
1185
|
return codepoints;
|
|
1177
1186
|
}
|
|
1178
|
-
/**
|
|
1179
|
-
* SASLprep.
|
|
1180
|
-
* @param {string} input
|
|
1181
|
-
* @param {Object} opts
|
|
1182
|
-
* @param {boolean} opts.allowUnassigned
|
|
1183
|
-
* @returns {string}
|
|
1187
|
+
/**
|
|
1188
|
+
* SASLprep.
|
|
1189
|
+
* @param {string} input
|
|
1190
|
+
* @param {Object} opts
|
|
1191
|
+
* @param {boolean} opts.allowUnassigned
|
|
1192
|
+
* @returns {string}
|
|
1184
1193
|
*/
|
|
1185
1194
|
|
|
1186
1195
|
|
|
@@ -1230,10 +1239,10 @@ function saslprep(input) {
|
|
|
1230
1239
|
if (hasBidiRAL && hasBidiL) {
|
|
1231
1240
|
throw new Error('String must not contain RandALCat and LCat at the same time,' + ' see https://tools.ietf.org/html/rfc3454#section-6');
|
|
1232
1241
|
}
|
|
1233
|
-
/**
|
|
1234
|
-
* 4.2 If a string contains any RandALCat character, a RandALCat
|
|
1235
|
-
* character MUST be the first character of the string, and a
|
|
1236
|
-
* RandALCat character MUST be the last character of the string.
|
|
1242
|
+
/**
|
|
1243
|
+
* 4.2 If a string contains any RandALCat character, a RandALCat
|
|
1244
|
+
* character MUST be the first character of the string, and a
|
|
1245
|
+
* RandALCat character MUST be the last character of the string.
|
|
1237
1246
|
*/
|
|
1238
1247
|
|
|
1239
1248
|
|
|
@@ -1248,41 +1257,6 @@ function saslprep(input) {
|
|
|
1248
1257
|
}
|
|
1249
1258
|
|
|
1250
1259
|
var PDFSecurity = /*#__PURE__*/function () {
|
|
1251
|
-
_createClass(PDFSecurity, null, [{
|
|
1252
|
-
key: "generateFileID",
|
|
1253
|
-
value: function generateFileID() {
|
|
1254
|
-
var info = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1255
|
-
var infoStr = "".concat(info.CreationDate.getTime(), "\n");
|
|
1256
|
-
|
|
1257
|
-
for (var key in info) {
|
|
1258
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
1259
|
-
if (!info.hasOwnProperty(key)) {
|
|
1260
|
-
continue;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
infoStr += "".concat(key, ": ").concat(info[key].valueOf(), "\n");
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
return wordArrayToBuffer(CryptoJS.MD5(infoStr));
|
|
1267
|
-
}
|
|
1268
|
-
}, {
|
|
1269
|
-
key: "generateRandomWordArray",
|
|
1270
|
-
value: function generateRandomWordArray(bytes) {
|
|
1271
|
-
return CryptoJS.lib.WordArray.random(bytes);
|
|
1272
|
-
}
|
|
1273
|
-
}, {
|
|
1274
|
-
key: "create",
|
|
1275
|
-
value: function create(document) {
|
|
1276
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1277
|
-
|
|
1278
|
-
if (!options.ownerPassword && !options.userPassword) {
|
|
1279
|
-
return null;
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
return new PDFSecurity(document, options);
|
|
1283
|
-
}
|
|
1284
|
-
}]);
|
|
1285
|
-
|
|
1286
1260
|
function PDFSecurity(document) {
|
|
1287
1261
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1288
1262
|
|
|
@@ -1475,6 +1449,39 @@ var PDFSecurity = /*#__PURE__*/function () {
|
|
|
1475
1449
|
value: function end() {
|
|
1476
1450
|
this.dictionary.end();
|
|
1477
1451
|
}
|
|
1452
|
+
}], [{
|
|
1453
|
+
key: "generateFileID",
|
|
1454
|
+
value: function generateFileID() {
|
|
1455
|
+
var info = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1456
|
+
var infoStr = "".concat(info.CreationDate.getTime(), "\n");
|
|
1457
|
+
|
|
1458
|
+
for (var key in info) {
|
|
1459
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
1460
|
+
if (!info.hasOwnProperty(key)) {
|
|
1461
|
+
continue;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
infoStr += "".concat(key, ": ").concat(info[key].valueOf(), "\n");
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
return wordArrayToBuffer(CryptoJS.MD5(infoStr));
|
|
1468
|
+
}
|
|
1469
|
+
}, {
|
|
1470
|
+
key: "generateRandomWordArray",
|
|
1471
|
+
value: function generateRandomWordArray(bytes) {
|
|
1472
|
+
return CryptoJS.lib.WordArray.random(bytes);
|
|
1473
|
+
}
|
|
1474
|
+
}, {
|
|
1475
|
+
key: "create",
|
|
1476
|
+
value: function create(document) {
|
|
1477
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1478
|
+
|
|
1479
|
+
if (!options.ownerPassword && !options.userPassword) {
|
|
1480
|
+
return null;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
return new PDFSecurity(document, options);
|
|
1484
|
+
}
|
|
1478
1485
|
}]);
|
|
1479
1486
|
|
|
1480
1487
|
return PDFSecurity;
|
|
@@ -1891,7 +1898,7 @@ var PDFGradient = /*#__PURE__*/function () {
|
|
|
1891
1898
|
}
|
|
1892
1899
|
}, {
|
|
1893
1900
|
key: "apply",
|
|
1894
|
-
value: function apply(
|
|
1901
|
+
value: function apply(stroke) {
|
|
1895
1902
|
// apply gradient transform to existing document ctm
|
|
1896
1903
|
var _this$doc$_ctm = _slicedToArray(this.doc._ctm, 6),
|
|
1897
1904
|
m0 = _this$doc$_ctm[0],
|
|
@@ -1915,6 +1922,9 @@ var PDFGradient = /*#__PURE__*/function () {
|
|
|
1915
1922
|
this.embed(m);
|
|
1916
1923
|
}
|
|
1917
1924
|
|
|
1925
|
+
this.doc._setColorSpace('Pattern', stroke);
|
|
1926
|
+
|
|
1927
|
+
var op = stroke ? 'SCN' : 'scn';
|
|
1918
1928
|
return this.doc.addContent("/".concat(this.id, " ").concat(op));
|
|
1919
1929
|
}
|
|
1920
1930
|
}]);
|
|
@@ -2009,21 +2019,143 @@ var Gradient = {
|
|
|
2009
2019
|
PDFRadialGradient: PDFRadialGradient
|
|
2010
2020
|
};
|
|
2011
2021
|
|
|
2022
|
+
/*
|
|
2023
|
+
PDF tiling pattern support. Uncolored only.
|
|
2024
|
+
*/
|
|
2025
|
+
var underlyingColorSpaces = ['DeviceCMYK', 'DeviceRGB'];
|
|
2026
|
+
|
|
2027
|
+
var PDFTilingPattern = /*#__PURE__*/function () {
|
|
2028
|
+
function PDFTilingPattern(doc, bBox, xStep, yStep, stream) {
|
|
2029
|
+
_classCallCheck(this, PDFTilingPattern);
|
|
2030
|
+
|
|
2031
|
+
this.doc = doc;
|
|
2032
|
+
this.bBox = bBox;
|
|
2033
|
+
this.xStep = xStep;
|
|
2034
|
+
this.yStep = yStep;
|
|
2035
|
+
this.stream = stream;
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
_createClass(PDFTilingPattern, [{
|
|
2039
|
+
key: "createPattern",
|
|
2040
|
+
value: function createPattern() {
|
|
2041
|
+
// no resources needed for our current usage
|
|
2042
|
+
// required entry
|
|
2043
|
+
var resources = this.doc.ref();
|
|
2044
|
+
resources.end(); // apply default transform matrix (flipped in the default doc._ctm)
|
|
2045
|
+
// see document.js & gradient.js
|
|
2046
|
+
|
|
2047
|
+
var _this$doc$_ctm = _slicedToArray(this.doc._ctm, 6),
|
|
2048
|
+
m0 = _this$doc$_ctm[0],
|
|
2049
|
+
m1 = _this$doc$_ctm[1],
|
|
2050
|
+
m2 = _this$doc$_ctm[2],
|
|
2051
|
+
m3 = _this$doc$_ctm[3],
|
|
2052
|
+
m4 = _this$doc$_ctm[4],
|
|
2053
|
+
m5 = _this$doc$_ctm[5];
|
|
2054
|
+
|
|
2055
|
+
var m11 = 1,
|
|
2056
|
+
m12 = 0,
|
|
2057
|
+
m21 = 0,
|
|
2058
|
+
m22 = 1,
|
|
2059
|
+
dx = 0,
|
|
2060
|
+
dy = 0;
|
|
2061
|
+
var m = [m0 * m11 + m2 * m12, m1 * m11 + m3 * m12, m0 * m21 + m2 * m22, m1 * m21 + m3 * m22, m0 * dx + m2 * dy + m4, m1 * dx + m3 * dy + m5];
|
|
2062
|
+
var pattern = this.doc.ref({
|
|
2063
|
+
Type: 'Pattern',
|
|
2064
|
+
PatternType: 1,
|
|
2065
|
+
// tiling
|
|
2066
|
+
PaintType: 2,
|
|
2067
|
+
// 1-colored, 2-uncolored
|
|
2068
|
+
TilingType: 2,
|
|
2069
|
+
// 2-no distortion
|
|
2070
|
+
BBox: this.bBox,
|
|
2071
|
+
XStep: this.xStep,
|
|
2072
|
+
YStep: this.yStep,
|
|
2073
|
+
Matrix: m.map(function (v) {
|
|
2074
|
+
return +v.toFixed(5);
|
|
2075
|
+
}),
|
|
2076
|
+
Resources: resources
|
|
2077
|
+
});
|
|
2078
|
+
pattern.end(this.stream);
|
|
2079
|
+
return pattern;
|
|
2080
|
+
}
|
|
2081
|
+
}, {
|
|
2082
|
+
key: "embedPatternColorSpaces",
|
|
2083
|
+
value: function embedPatternColorSpaces() {
|
|
2084
|
+
var _this = this;
|
|
2085
|
+
|
|
2086
|
+
// map each pattern to an underlying color space
|
|
2087
|
+
// and embed on each page
|
|
2088
|
+
underlyingColorSpaces.forEach(function (csName) {
|
|
2089
|
+
var csId = _this.getPatternColorSpaceId(csName);
|
|
2090
|
+
|
|
2091
|
+
if (_this.doc.page.colorSpaces[csId]) return;
|
|
2092
|
+
|
|
2093
|
+
var cs = _this.doc.ref(['Pattern', csName]);
|
|
2094
|
+
|
|
2095
|
+
cs.end();
|
|
2096
|
+
_this.doc.page.colorSpaces[csId] = cs;
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
}, {
|
|
2100
|
+
key: "getPatternColorSpaceId",
|
|
2101
|
+
value: function getPatternColorSpaceId(underlyingColorspace) {
|
|
2102
|
+
return "CsP".concat(underlyingColorspace);
|
|
2103
|
+
}
|
|
2104
|
+
}, {
|
|
2105
|
+
key: "embed",
|
|
2106
|
+
value: function embed() {
|
|
2107
|
+
if (!this.id) {
|
|
2108
|
+
this.doc._patternCount = this.doc._patternCount + 1;
|
|
2109
|
+
this.id = 'P' + this.doc._patternCount;
|
|
2110
|
+
this.pattern = this.createPattern();
|
|
2111
|
+
} // patterns are embedded in each page
|
|
2112
|
+
|
|
2113
|
+
|
|
2114
|
+
if (!this.doc.page.patterns[this.id]) {
|
|
2115
|
+
this.doc.page.patterns[this.id] = this.pattern;
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
}, {
|
|
2119
|
+
key: "apply",
|
|
2120
|
+
value: function apply(stroke, patternColor) {
|
|
2121
|
+
// do any embedding/creating that might be needed
|
|
2122
|
+
this.embedPatternColorSpaces();
|
|
2123
|
+
this.embed();
|
|
2124
|
+
|
|
2125
|
+
var normalizedColor = this.doc._normalizeColor(patternColor);
|
|
2126
|
+
|
|
2127
|
+
if (!normalizedColor) throw Error("invalid pattern color. (value: ".concat(patternColor, ")")); // select one of the pattern color spaces
|
|
2128
|
+
|
|
2129
|
+
var csId = this.getPatternColorSpaceId(this.doc._getColorSpace(normalizedColor));
|
|
2130
|
+
|
|
2131
|
+
this.doc._setColorSpace(csId, stroke); // stroke/fill using the pattern and color (in the above underlying color space)
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
var op = stroke ? 'SCN' : 'scn';
|
|
2135
|
+
return this.doc.addContent("".concat(normalizedColor.join(' '), " /").concat(this.id, " ").concat(op));
|
|
2136
|
+
}
|
|
2137
|
+
}]);
|
|
2138
|
+
|
|
2139
|
+
return PDFTilingPattern;
|
|
2140
|
+
}();
|
|
2141
|
+
|
|
2142
|
+
var pattern = {
|
|
2143
|
+
PDFTilingPattern: PDFTilingPattern
|
|
2144
|
+
};
|
|
2145
|
+
|
|
2012
2146
|
var PDFGradient$1 = Gradient.PDFGradient,
|
|
2013
2147
|
PDFLinearGradient$1 = Gradient.PDFLinearGradient,
|
|
2014
2148
|
PDFRadialGradient$1 = Gradient.PDFRadialGradient;
|
|
2149
|
+
var PDFTilingPattern$1 = pattern.PDFTilingPattern;
|
|
2015
2150
|
var ColorMixin = {
|
|
2016
2151
|
initColor: function initColor() {
|
|
2017
2152
|
// The opacity dictionaries
|
|
2018
2153
|
this._opacityRegistry = {};
|
|
2019
2154
|
this._opacityCount = 0;
|
|
2155
|
+
this._patternCount = 0;
|
|
2020
2156
|
return this._gradCount = 0;
|
|
2021
2157
|
},
|
|
2022
2158
|
_normalizeColor: function _normalizeColor(color) {
|
|
2023
|
-
if (color instanceof PDFGradient$1) {
|
|
2024
|
-
return color;
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
2159
|
if (typeof color === 'string') {
|
|
2028
2160
|
if (color.charAt(0) === '#') {
|
|
2029
2161
|
if (color.length === 4) {
|
|
@@ -2055,6 +2187,18 @@ var ColorMixin = {
|
|
|
2055
2187
|
return null;
|
|
2056
2188
|
},
|
|
2057
2189
|
_setColor: function _setColor(color, stroke) {
|
|
2190
|
+
if (color instanceof PDFGradient$1) {
|
|
2191
|
+
color.apply(stroke);
|
|
2192
|
+
return true; // see if tiling pattern, decode & apply it it
|
|
2193
|
+
} else if (Array.isArray(color) && color[0] instanceof PDFTilingPattern$1) {
|
|
2194
|
+
color[0].apply(stroke, color[1]);
|
|
2195
|
+
return true;
|
|
2196
|
+
} // any other case should be a normal color and not a pattern
|
|
2197
|
+
|
|
2198
|
+
|
|
2199
|
+
return this._setColorCore(color, stroke);
|
|
2200
|
+
},
|
|
2201
|
+
_setColorCore: function _setColorCore(color, stroke) {
|
|
2058
2202
|
color = this._normalizeColor(color);
|
|
2059
2203
|
|
|
2060
2204
|
if (!color) {
|
|
@@ -2063,25 +2207,21 @@ var ColorMixin = {
|
|
|
2063
2207
|
|
|
2064
2208
|
var op = stroke ? 'SCN' : 'scn';
|
|
2065
2209
|
|
|
2066
|
-
|
|
2067
|
-
this._setColorSpace('Pattern', stroke);
|
|
2068
|
-
|
|
2069
|
-
color.apply(op);
|
|
2070
|
-
} else {
|
|
2071
|
-
var space = color.length === 4 ? 'DeviceCMYK' : 'DeviceRGB';
|
|
2210
|
+
var space = this._getColorSpace(color);
|
|
2072
2211
|
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
color = color.join(' ');
|
|
2076
|
-
this.addContent("".concat(color, " ").concat(op));
|
|
2077
|
-
}
|
|
2212
|
+
this._setColorSpace(space, stroke);
|
|
2078
2213
|
|
|
2214
|
+
color = color.join(' ');
|
|
2215
|
+
this.addContent("".concat(color, " ").concat(op));
|
|
2079
2216
|
return true;
|
|
2080
2217
|
},
|
|
2081
2218
|
_setColorSpace: function _setColorSpace(space, stroke) {
|
|
2082
2219
|
var op = stroke ? 'CS' : 'cs';
|
|
2083
2220
|
return this.addContent("/".concat(space, " ").concat(op));
|
|
2084
2221
|
},
|
|
2222
|
+
_getColorSpace: function _getColorSpace(color) {
|
|
2223
|
+
return color.length === 4 ? 'DeviceCMYK' : 'DeviceRGB';
|
|
2224
|
+
},
|
|
2085
2225
|
fillColor: function fillColor(color, opacity) {
|
|
2086
2226
|
var set = this._setColor(color, false);
|
|
2087
2227
|
|
|
@@ -2168,6 +2308,9 @@ var ColorMixin = {
|
|
|
2168
2308
|
},
|
|
2169
2309
|
radialGradient: function radialGradient(x1, y1, r1, x2, y2, r2) {
|
|
2170
2310
|
return new PDFRadialGradient$1(this, x1, y1, r1, x2, y2, r2);
|
|
2311
|
+
},
|
|
2312
|
+
pattern: function pattern(bbox, xStep, yStep, stream) {
|
|
2313
|
+
return new PDFTilingPattern$1(this, bbox, xStep, yStep, stream);
|
|
2171
2314
|
}
|
|
2172
2315
|
};
|
|
2173
2316
|
var namedColors = {
|
|
@@ -3101,13 +3244,6 @@ var WIN_ANSI_MAP = {
|
|
|
3101
3244
|
var characters = ".notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n \nspace exclam quotedbl numbersign\ndollar percent ampersand quotesingle\nparenleft parenright asterisk plus\ncomma hyphen period slash\nzero one two three\nfour five six seven\neight nine colon semicolon\nless equal greater question\n \nat A B C\nD E F G\nH I J K\nL M N O\nP Q R S\nT U V W\nX Y Z bracketleft\nbackslash bracketright asciicircum underscore\n \ngrave a b c\nd e f g\nh i j k\nl m n o\np q r s\nt u v w\nx y z braceleft\nbar braceright asciitilde .notdef\n \nEuro .notdef quotesinglbase florin\nquotedblbase ellipsis dagger daggerdbl\ncircumflex perthousand Scaron guilsinglleft\nOE .notdef Zcaron .notdef\n.notdef quoteleft quoteright quotedblleft\nquotedblright bullet endash emdash\ntilde trademark scaron guilsinglright\noe .notdef zcaron ydieresis\n \nspace exclamdown cent sterling\ncurrency yen brokenbar section\ndieresis copyright ordfeminine guillemotleft\nlogicalnot hyphen registered macron\ndegree plusminus twosuperior threesuperior\nacute mu paragraph periodcentered\ncedilla onesuperior ordmasculine guillemotright\nonequarter onehalf threequarters questiondown\n \nAgrave Aacute Acircumflex Atilde\nAdieresis Aring AE Ccedilla\nEgrave Eacute Ecircumflex Edieresis\nIgrave Iacute Icircumflex Idieresis\nEth Ntilde Ograve Oacute\nOcircumflex Otilde Odieresis multiply\nOslash Ugrave Uacute Ucircumflex\nUdieresis Yacute Thorn germandbls\n \nagrave aacute acircumflex atilde\nadieresis aring ae ccedilla\negrave eacute ecircumflex edieresis\nigrave iacute icircumflex idieresis\neth ntilde ograve oacute\nocircumflex otilde odieresis divide\noslash ugrave uacute ucircumflex\nudieresis yacute thorn ydieresis".split(/\s+/);
|
|
3102
3245
|
|
|
3103
3246
|
var AFMFont = /*#__PURE__*/function () {
|
|
3104
|
-
_createClass(AFMFont, null, [{
|
|
3105
|
-
key: "open",
|
|
3106
|
-
value: function open(filename) {
|
|
3107
|
-
return new AFMFont(fs.readFileSync(filename, 'utf8'));
|
|
3108
|
-
}
|
|
3109
|
-
}]);
|
|
3110
|
-
|
|
3111
3247
|
function AFMFont(contents) {
|
|
3112
3248
|
_classCallCheck(this, AFMFont);
|
|
3113
3249
|
|
|
@@ -3252,6 +3388,11 @@ var AFMFont = /*#__PURE__*/function () {
|
|
|
3252
3388
|
|
|
3253
3389
|
return advances;
|
|
3254
3390
|
}
|
|
3391
|
+
}], [{
|
|
3392
|
+
key: "open",
|
|
3393
|
+
value: function open(filename) {
|
|
3394
|
+
return new AFMFont(fs.readFileSync(filename, 'utf8'));
|
|
3395
|
+
}
|
|
3255
3396
|
}]);
|
|
3256
3397
|
|
|
3257
3398
|
return AFMFont;
|
|
@@ -4602,10 +4743,10 @@ var TextMixin = {
|
|
|
4602
4743
|
|
|
4603
4744
|
if (options.destination != null) {
|
|
4604
4745
|
this.addNamedDestination(options.destination, 'XYZ', x, y, null);
|
|
4605
|
-
} // create underline
|
|
4746
|
+
} // create underline
|
|
4606
4747
|
|
|
4607
4748
|
|
|
4608
|
-
if (options.underline
|
|
4749
|
+
if (options.underline) {
|
|
4609
4750
|
this.save();
|
|
4610
4751
|
|
|
4611
4752
|
if (!options.stroke) {
|
|
@@ -4614,15 +4755,29 @@ var TextMixin = {
|
|
|
4614
4755
|
|
|
4615
4756
|
var lineWidth = this._fontSize < 10 ? 0.5 : Math.floor(this._fontSize / 10);
|
|
4616
4757
|
this.lineWidth(lineWidth);
|
|
4617
|
-
var
|
|
4618
|
-
|
|
4758
|
+
var lineY = y + this.currentLineHeight() - lineWidth;
|
|
4759
|
+
this.moveTo(x, lineY);
|
|
4760
|
+
this.lineTo(x + renderedWidth, lineY);
|
|
4761
|
+
this.stroke();
|
|
4762
|
+
this.restore();
|
|
4763
|
+
} // create strikethrough line
|
|
4764
|
+
|
|
4765
|
+
|
|
4766
|
+
if (options.strike) {
|
|
4767
|
+
this.save();
|
|
4619
4768
|
|
|
4620
|
-
if (options.
|
|
4621
|
-
|
|
4769
|
+
if (!options.stroke) {
|
|
4770
|
+
this.strokeColor.apply(this, _toConsumableArray(this._fillColor || []));
|
|
4622
4771
|
}
|
|
4623
4772
|
|
|
4624
|
-
this.
|
|
4625
|
-
|
|
4773
|
+
var _lineWidth = this._fontSize < 10 ? 0.5 : Math.floor(this._fontSize / 10);
|
|
4774
|
+
|
|
4775
|
+
this.lineWidth(_lineWidth);
|
|
4776
|
+
|
|
4777
|
+
var _lineY = y + this.currentLineHeight() / 2;
|
|
4778
|
+
|
|
4779
|
+
this.moveTo(x, _lineY);
|
|
4780
|
+
this.lineTo(x + renderedWidth, _lineY);
|
|
4626
4781
|
this.stroke();
|
|
4627
4782
|
this.restore();
|
|
4628
4783
|
}
|
|
@@ -5506,9 +5661,9 @@ var OutlineMixin = {
|
|
|
5506
5661
|
}
|
|
5507
5662
|
};
|
|
5508
5663
|
|
|
5509
|
-
/*
|
|
5510
|
-
PDFStructureContent - a reference to a marked structure content
|
|
5511
|
-
By Ben Schmidt
|
|
5664
|
+
/*
|
|
5665
|
+
PDFStructureContent - a reference to a marked structure content
|
|
5666
|
+
By Ben Schmidt
|
|
5512
5667
|
*/
|
|
5513
5668
|
var PDFStructureContent = /*#__PURE__*/function () {
|
|
5514
5669
|
function PDFStructureContent(pageRef, mcid) {
|
|
@@ -5818,7 +5973,8 @@ var MarkingsMixin = {
|
|
|
5818
5973
|
this.structChildren = [];
|
|
5819
5974
|
|
|
5820
5975
|
if (options.tagged) {
|
|
5821
|
-
this.
|
|
5976
|
+
this.getMarkInfoDictionary().data.Marked = true;
|
|
5977
|
+
this.getStructTreeRoot();
|
|
5822
5978
|
}
|
|
5823
5979
|
},
|
|
5824
5980
|
markContent: function markContent(tag) {
|
|
@@ -5951,17 +6107,17 @@ var MarkingsMixin = {
|
|
|
5951
6107
|
page.markings = [];
|
|
5952
6108
|
return pageMarkings;
|
|
5953
6109
|
},
|
|
5954
|
-
|
|
5955
|
-
if (!this._root.data.
|
|
5956
|
-
this._root.data.
|
|
6110
|
+
getMarkInfoDictionary: function getMarkInfoDictionary() {
|
|
6111
|
+
if (!this._root.data.MarkInfo) {
|
|
6112
|
+
this._root.data.MarkInfo = this.ref({});
|
|
5957
6113
|
}
|
|
5958
6114
|
|
|
5959
|
-
return this._root.data.
|
|
6115
|
+
return this._root.data.MarkInfo;
|
|
5960
6116
|
},
|
|
5961
6117
|
getStructTreeRoot: function getStructTreeRoot() {
|
|
5962
6118
|
if (!this._root.data.StructTreeRoot) {
|
|
5963
6119
|
this._root.data.StructTreeRoot = this.ref({
|
|
5964
|
-
Type:
|
|
6120
|
+
Type: 'StructTreeRoot',
|
|
5965
6121
|
ParentTree: new PDFNumberTree(),
|
|
5966
6122
|
ParentTreeNextKey: 0
|
|
5967
6123
|
});
|
|
@@ -5973,8 +6129,8 @@ var MarkingsMixin = {
|
|
|
5973
6129
|
return this.getStructTreeRoot().data.ParentTree;
|
|
5974
6130
|
},
|
|
5975
6131
|
createStructParentTreeNextKey: function createStructParentTreeNextKey() {
|
|
5976
|
-
// initialise the
|
|
5977
|
-
this.
|
|
6132
|
+
// initialise the MarkInfo dictionary
|
|
6133
|
+
this.getMarkInfoDictionary();
|
|
5978
6134
|
var structTreeRoot = this.getStructTreeRoot();
|
|
5979
6135
|
var key = structTreeRoot.data.ParentTreeNextKey++;
|
|
5980
6136
|
structTreeRoot.data.ParentTree.add(key, []);
|
|
@@ -5990,8 +6146,8 @@ var MarkingsMixin = {
|
|
|
5990
6146
|
});
|
|
5991
6147
|
}
|
|
5992
6148
|
|
|
5993
|
-
if (this._root.data.
|
|
5994
|
-
this._root.data.
|
|
6149
|
+
if (this._root.data.MarkInfo) {
|
|
6150
|
+
this._root.data.MarkInfo.end();
|
|
5995
6151
|
}
|
|
5996
6152
|
}
|
|
5997
6153
|
};
|
|
@@ -6041,9 +6197,9 @@ var FORMAT_DEFAULT = {
|
|
|
6041
6197
|
}
|
|
6042
6198
|
};
|
|
6043
6199
|
var AcroFormMixin = {
|
|
6044
|
-
/**
|
|
6045
|
-
* Must call if adding AcroForms to a document. Must also call font() before
|
|
6046
|
-
* this method to set the default font.
|
|
6200
|
+
/**
|
|
6201
|
+
* Must call if adding AcroForms to a document. Must also call font() before
|
|
6202
|
+
* this method to set the default font.
|
|
6047
6203
|
*/
|
|
6048
6204
|
initForm: function initForm() {
|
|
6049
6205
|
if (!this._font) {
|
|
@@ -6069,8 +6225,8 @@ var AcroFormMixin = {
|
|
|
6069
6225
|
return this;
|
|
6070
6226
|
},
|
|
6071
6227
|
|
|
6072
|
-
/**
|
|
6073
|
-
* Called automatically by document.js
|
|
6228
|
+
/**
|
|
6229
|
+
* Called automatically by document.js
|
|
6074
6230
|
*/
|
|
6075
6231
|
endAcroForm: function endAcroForm() {
|
|
6076
6232
|
var _this = this;
|
|
@@ -6107,12 +6263,12 @@ var AcroFormMixin = {
|
|
|
6107
6263
|
return this;
|
|
6108
6264
|
},
|
|
6109
6265
|
|
|
6110
|
-
/**
|
|
6111
|
-
* Creates and adds a form field to the document. Form fields are intermediate
|
|
6112
|
-
* nodes in a PDF form that are used to specify form name heirarchy and form
|
|
6113
|
-
* value defaults.
|
|
6114
|
-
* @param {string} name - field name (T attribute in field dictionary)
|
|
6115
|
-
* @param {object} options - other attributes to include in field dictionary
|
|
6266
|
+
/**
|
|
6267
|
+
* Creates and adds a form field to the document. Form fields are intermediate
|
|
6268
|
+
* nodes in a PDF form that are used to specify form name heirarchy and form
|
|
6269
|
+
* value defaults.
|
|
6270
|
+
* @param {string} name - field name (T attribute in field dictionary)
|
|
6271
|
+
* @param {object} options - other attributes to include in field dictionary
|
|
6116
6272
|
*/
|
|
6117
6273
|
formField: function formField(name) {
|
|
6118
6274
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -6126,16 +6282,16 @@ var AcroFormMixin = {
|
|
|
6126
6282
|
return fieldRef;
|
|
6127
6283
|
},
|
|
6128
6284
|
|
|
6129
|
-
/**
|
|
6130
|
-
* Creates and adds a Form Annotation to the document. Form annotations are
|
|
6131
|
-
* called Widget annotations internally within a PDF file.
|
|
6132
|
-
* @param {string} name - form field name (T attribute of widget annotation
|
|
6133
|
-
* dictionary)
|
|
6134
|
-
* @param {number} x
|
|
6135
|
-
* @param {number} y
|
|
6136
|
-
* @param {number} w
|
|
6137
|
-
* @param {number} h
|
|
6138
|
-
* @param {object} options
|
|
6285
|
+
/**
|
|
6286
|
+
* Creates and adds a Form Annotation to the document. Form annotations are
|
|
6287
|
+
* called Widget annotations internally within a PDF file.
|
|
6288
|
+
* @param {string} name - form field name (T attribute of widget annotation
|
|
6289
|
+
* dictionary)
|
|
6290
|
+
* @param {number} x
|
|
6291
|
+
* @param {number} y
|
|
6292
|
+
* @param {number} w
|
|
6293
|
+
* @param {number} h
|
|
6294
|
+
* @param {object} options
|
|
6139
6295
|
*/
|
|
6140
6296
|
formAnnotation: function formAnnotation(name, type, x, y, w, h) {
|
|
6141
6297
|
var options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
|
|
@@ -6356,9 +6512,11 @@ var AcroFormMixin = {
|
|
|
6356
6512
|
if (this._acroform.defaultFont !== this._font.name) {
|
|
6357
6513
|
options.DR = {
|
|
6358
6514
|
Font: {}
|
|
6359
|
-
};
|
|
6515
|
+
}; // Get the fontSize option. If not set use auto sizing
|
|
6516
|
+
|
|
6517
|
+
var fontSize = options.fontSize || 0;
|
|
6360
6518
|
options.DR.Font[this._font.id] = this._font.ref();
|
|
6361
|
-
options.DA = new String("/".concat(this._font.id, "
|
|
6519
|
+
options.DA = new String("/".concat(this._font.id, " ").concat(fontSize, " Tf 0 g"));
|
|
6362
6520
|
}
|
|
6363
6521
|
|
|
6364
6522
|
return options;
|
|
@@ -6416,17 +6574,17 @@ var AcroFormMixin = {
|
|
|
6416
6574
|
};
|
|
6417
6575
|
|
|
6418
6576
|
var AttachmentsMixin = {
|
|
6419
|
-
/**
|
|
6420
|
-
* Embed contents of `src` in PDF
|
|
6421
|
-
* @param {Buffer | ArrayBuffer | string} src input Buffer, ArrayBuffer, base64 encoded string or path to file
|
|
6422
|
-
* @param {object} options
|
|
6423
|
-
* * options.name: filename to be shown in PDF, will use `src` if none set
|
|
6424
|
-
* * options.type: filetype to be shown in PDF
|
|
6425
|
-
* * options.description: description to be shown in PDF
|
|
6426
|
-
* * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
|
|
6427
|
-
* * options.creationDate: override creation date
|
|
6428
|
-
* * options.modifiedDate: override modified date
|
|
6429
|
-
* @returns filespec reference
|
|
6577
|
+
/**
|
|
6578
|
+
* Embed contents of `src` in PDF
|
|
6579
|
+
* @param {Buffer | ArrayBuffer | string} src input Buffer, ArrayBuffer, base64 encoded string or path to file
|
|
6580
|
+
* @param {object} options
|
|
6581
|
+
* * options.name: filename to be shown in PDF, will use `src` if none set
|
|
6582
|
+
* * options.type: filetype to be shown in PDF
|
|
6583
|
+
* * options.description: description to be shown in PDF
|
|
6584
|
+
* * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
|
|
6585
|
+
* * options.creationDate: override creation date
|
|
6586
|
+
* * options.modifiedDate: override modified date
|
|
6587
|
+
* @returns filespec reference
|
|
6430
6588
|
*/
|
|
6431
6589
|
file: function file(src) {
|
|
6432
6590
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -6532,11 +6690,7 @@ var AttachmentsMixin = {
|
|
|
6532
6690
|
/** check two embedded file metadata objects for equality */
|
|
6533
6691
|
|
|
6534
6692
|
function isEqual(a, b) {
|
|
6535
|
-
|
|
6536
|
-
return false;
|
|
6537
|
-
}
|
|
6538
|
-
|
|
6539
|
-
return true;
|
|
6693
|
+
return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && a.Params.CreationDate === b.Params.CreationDate && a.Params.ModDate === b.Params.ModDate;
|
|
6540
6694
|
}
|
|
6541
6695
|
|
|
6542
6696
|
var PDFDocument = /*#__PURE__*/function (_stream$Readable) {
|