pdfkit 0.12.0 → 0.12.1
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 +54 -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/font/data/Courier-Bold.afm +342 -0
- package/js/font/data/Courier-BoldOblique.afm +342 -0
- package/js/font/data/Courier-Oblique.afm +342 -0
- package/js/font/data/Courier.afm +342 -0
- package/js/font/data/Helvetica-Bold.afm +2827 -0
- package/js/font/data/Helvetica-BoldOblique.afm +2827 -0
- package/js/font/data/Helvetica-Oblique.afm +3051 -0
- package/js/font/data/Helvetica.afm +3051 -0
- package/js/font/data/Symbol.afm +213 -0
- package/js/font/data/Times-Bold.afm +2588 -0
- package/js/font/data/Times-BoldItalic.afm +2384 -0
- package/js/font/data/Times-Italic.afm +2667 -0
- package/js/font/data/Times-Roman.afm +2419 -0
- package/js/font/data/ZapfDingbats.afm +225 -0
- package/js/pdfkit.es5.js +114 -114
- package/js/pdfkit.es5.js.map +1 -1
- package/js/pdfkit.esnext.js +138 -138
- package/js/pdfkit.esnext.js.map +1 -1
- package/js/pdfkit.js +138 -138
- package/js/pdfkit.js.map +1 -1
- package/js/pdfkit.standalone.js +3021 -1874
- package/js/pdfkit.standalone.orig.js +68494 -0
- package/out.pdf +105 -0
- package/package.json +94 -94
- package/resultx.pdf +0 -0
package/js/pdfkit.esnext.js
CHANGED
|
@@ -7,8 +7,8 @@ import { EventEmitter } from 'events';
|
|
|
7
7
|
import LineBreaker from 'linebreak';
|
|
8
8
|
import PNG from 'png-js';
|
|
9
9
|
|
|
10
|
-
/*
|
|
11
|
-
PDFAbstractReference - abstract class for PDF reference
|
|
10
|
+
/*
|
|
11
|
+
PDFAbstractReference - abstract class for PDF reference
|
|
12
12
|
*/
|
|
13
13
|
class PDFAbstractReference {
|
|
14
14
|
toString() {
|
|
@@ -17,8 +17,8 @@ class PDFAbstractReference {
|
|
|
17
17
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/*
|
|
21
|
-
PDFTree - abstract base class for name and number tree objects
|
|
20
|
+
/*
|
|
21
|
+
PDFTree - abstract base class for name and number tree objects
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
class PDFTree {
|
|
@@ -77,9 +77,9 @@ class PDFTree {
|
|
|
77
77
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
/*
|
|
81
|
-
PDFObject - converts JavaScript types into their corresponding PDF types.
|
|
82
|
-
By Devon Govett
|
|
80
|
+
/*
|
|
81
|
+
PDFObject - converts JavaScript types into their corresponding PDF types.
|
|
82
|
+
By Devon Govett
|
|
83
83
|
*/
|
|
84
84
|
|
|
85
85
|
var pad = (str, length) => (Array(length + 1).join('0') + str).slice(-length);
|
|
@@ -195,9 +195,9 @@ class PDFObject {
|
|
|
195
195
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
/*
|
|
199
|
-
PDFReference - represents a reference to another object in the PDF object heirarchy
|
|
200
|
-
By Devon Govett
|
|
198
|
+
/*
|
|
199
|
+
PDFReference - represents a reference to another object in the PDF object heirarchy
|
|
200
|
+
By Devon Govett
|
|
201
201
|
*/
|
|
202
202
|
|
|
203
203
|
class PDFReference extends PDFAbstractReference {
|
|
@@ -283,9 +283,9 @@ class PDFReference extends PDFAbstractReference {
|
|
|
283
283
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
/*
|
|
287
|
-
PDFPage - represents a single page in the PDF document
|
|
288
|
-
By Devon Govett
|
|
286
|
+
/*
|
|
287
|
+
PDFPage - represents a single page in the PDF document
|
|
288
|
+
By Devon Govett
|
|
289
289
|
*/
|
|
290
290
|
var DEFAULT_MARGINS = {
|
|
291
291
|
top: 72,
|
|
@@ -431,8 +431,8 @@ class PDFPage {
|
|
|
431
431
|
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
/*
|
|
435
|
-
PDFNameTree - represents a name tree object
|
|
434
|
+
/*
|
|
435
|
+
PDFNameTree - represents a name tree object
|
|
436
436
|
*/
|
|
437
437
|
|
|
438
438
|
class PDFNameTree extends PDFTree {
|
|
@@ -450,11 +450,11 @@ class PDFNameTree extends PDFTree {
|
|
|
450
450
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
-
/**
|
|
454
|
-
* Check if value is in a range group.
|
|
455
|
-
* @param {number} value
|
|
456
|
-
* @param {number[]} rangeGroup
|
|
457
|
-
* @returns {boolean}
|
|
453
|
+
/**
|
|
454
|
+
* Check if value is in a range group.
|
|
455
|
+
* @param {number} value
|
|
456
|
+
* @param {number[]} rangeGroup
|
|
457
|
+
* @returns {boolean}
|
|
458
458
|
*/
|
|
459
459
|
function inRange(value, rangeGroup) {
|
|
460
460
|
if (value < rangeGroup[0]) return false;
|
|
@@ -482,18 +482,18 @@ function inRange(value, rangeGroup) {
|
|
|
482
482
|
return false;
|
|
483
483
|
}
|
|
484
484
|
|
|
485
|
-
/**
|
|
486
|
-
* A.1 Unassigned code points in Unicode 3.2
|
|
487
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-A.1
|
|
485
|
+
/**
|
|
486
|
+
* A.1 Unassigned code points in Unicode 3.2
|
|
487
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-A.1
|
|
488
488
|
*/
|
|
489
489
|
|
|
490
490
|
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
|
|
491
491
|
|
|
492
492
|
var isUnassignedCodePoint = character => inRange(character, unassigned_code_points); // prettier-ignore-start
|
|
493
493
|
|
|
494
|
-
/**
|
|
495
|
-
* B.1 Commonly mapped to nothing
|
|
496
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-B.1
|
|
494
|
+
/**
|
|
495
|
+
* B.1 Commonly mapped to nothing
|
|
496
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-B.1
|
|
497
497
|
*/
|
|
498
498
|
|
|
499
499
|
|
|
@@ -501,9 +501,9 @@ var commonly_mapped_to_nothing = [0x00ad, 0x00ad, 0x034f, 0x034f, 0x1806, 0x1806
|
|
|
501
501
|
|
|
502
502
|
var isCommonlyMappedToNothing = character => inRange(character, commonly_mapped_to_nothing); // prettier-ignore-start
|
|
503
503
|
|
|
504
|
-
/**
|
|
505
|
-
* C.1.2 Non-ASCII space characters
|
|
506
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2
|
|
504
|
+
/**
|
|
505
|
+
* C.1.2 Non-ASCII space characters
|
|
506
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2
|
|
507
507
|
*/
|
|
508
508
|
|
|
509
509
|
|
|
@@ -547,9 +547,9 @@ var isNonASCIISpaceCharacter = character => inRange(character, non_ASCII_space_c
|
|
|
547
547
|
|
|
548
548
|
|
|
549
549
|
var non_ASCII_controls_characters = [
|
|
550
|
-
/**
|
|
551
|
-
* C.2.2 Non-ASCII control characters
|
|
552
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2
|
|
550
|
+
/**
|
|
551
|
+
* C.2.2 Non-ASCII control characters
|
|
552
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2
|
|
553
553
|
*/
|
|
554
554
|
0x0080, 0x009f
|
|
555
555
|
/* [CONTROL CHARACTERS] */
|
|
@@ -585,9 +585,9 @@ var non_ASCII_controls_characters = [
|
|
|
585
585
|
/* [MUSICAL CONTROL CHARACTERS] */
|
|
586
586
|
];
|
|
587
587
|
var non_character_codepoints = [
|
|
588
|
-
/**
|
|
589
|
-
* C.4 Non-character code points
|
|
590
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.4
|
|
588
|
+
/**
|
|
589
|
+
* C.4 Non-character code points
|
|
590
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.4
|
|
591
591
|
*/
|
|
592
592
|
0xfdd0, 0xfdef
|
|
593
593
|
/* [NONCHARACTER CODE POINTS] */
|
|
@@ -624,23 +624,23 @@ var non_character_codepoints = [
|
|
|
624
624
|
, 0x10fffe, 0x10ffff
|
|
625
625
|
/* [NONCHARACTER CODE POINTS] */
|
|
626
626
|
];
|
|
627
|
-
/**
|
|
628
|
-
* 2.3. Prohibited Output
|
|
627
|
+
/**
|
|
628
|
+
* 2.3. Prohibited Output
|
|
629
629
|
*/
|
|
630
630
|
|
|
631
631
|
var prohibited_characters = [
|
|
632
|
-
/**
|
|
633
|
-
* C.2.1 ASCII control characters
|
|
634
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1
|
|
632
|
+
/**
|
|
633
|
+
* C.2.1 ASCII control characters
|
|
634
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1
|
|
635
635
|
*/
|
|
636
636
|
0, 0x001f
|
|
637
637
|
/* [CONTROL CHARACTERS] */
|
|
638
638
|
, 0x007f, 0x007f
|
|
639
639
|
/* DELETE */
|
|
640
640
|
,
|
|
641
|
-
/**
|
|
642
|
-
* C.8 Change display properties or are deprecated
|
|
643
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.8
|
|
641
|
+
/**
|
|
642
|
+
* C.8 Change display properties or are deprecated
|
|
643
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.8
|
|
644
644
|
*/
|
|
645
645
|
0x0340, 0x0340
|
|
646
646
|
/* COMBINING GRAVE TONE MARK */
|
|
@@ -673,28 +673,28 @@ var prohibited_characters = [
|
|
|
673
673
|
, 0x206f, 0x206f
|
|
674
674
|
/* NOMINAL DIGIT SHAPES */
|
|
675
675
|
,
|
|
676
|
-
/**
|
|
677
|
-
* C.7 Inappropriate for canonical representation
|
|
678
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.7
|
|
676
|
+
/**
|
|
677
|
+
* C.7 Inappropriate for canonical representation
|
|
678
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.7
|
|
679
679
|
*/
|
|
680
680
|
0x2ff0, 0x2ffb
|
|
681
681
|
/* [IDEOGRAPHIC DESCRIPTION CHARACTERS] */
|
|
682
682
|
,
|
|
683
|
-
/**
|
|
684
|
-
* C.5 Surrogate codes
|
|
685
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.5
|
|
683
|
+
/**
|
|
684
|
+
* C.5 Surrogate codes
|
|
685
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.5
|
|
686
686
|
*/
|
|
687
687
|
0xd800, 0xdfff,
|
|
688
|
-
/**
|
|
689
|
-
* C.3 Private use
|
|
690
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
688
|
+
/**
|
|
689
|
+
* C.3 Private use
|
|
690
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
691
691
|
*/
|
|
692
692
|
0xe000, 0xf8ff
|
|
693
693
|
/* [PRIVATE USE, PLANE 0] */
|
|
694
694
|
,
|
|
695
|
-
/**
|
|
696
|
-
* C.6 Inappropriate for plain text
|
|
697
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.6
|
|
695
|
+
/**
|
|
696
|
+
* C.6 Inappropriate for plain text
|
|
697
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.6
|
|
698
698
|
*/
|
|
699
699
|
0xfff9, 0xfff9
|
|
700
700
|
/* INTERLINEAR ANNOTATION ANCHOR */
|
|
@@ -707,18 +707,18 @@ var prohibited_characters = [
|
|
|
707
707
|
, 0xfffd, 0xfffd
|
|
708
708
|
/* REPLACEMENT CHARACTER */
|
|
709
709
|
,
|
|
710
|
-
/**
|
|
711
|
-
* C.9 Tagging characters
|
|
712
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.9
|
|
710
|
+
/**
|
|
711
|
+
* C.9 Tagging characters
|
|
712
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.9
|
|
713
713
|
*/
|
|
714
714
|
0xe0001, 0xe0001
|
|
715
715
|
/* LANGUAGE TAG */
|
|
716
716
|
, 0xe0020, 0xe007f
|
|
717
717
|
/* [TAGGING CHARACTERS] */
|
|
718
718
|
,
|
|
719
|
-
/**
|
|
720
|
-
* C.3 Private use
|
|
721
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
719
|
+
/**
|
|
720
|
+
* C.3 Private use
|
|
721
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
722
722
|
*/
|
|
723
723
|
0xf0000, 0xffffd
|
|
724
724
|
/* [PRIVATE USE, PLANE 15] */
|
|
@@ -728,9 +728,9 @@ var prohibited_characters = [
|
|
|
728
728
|
|
|
729
729
|
var isProhibitedCharacter = character => inRange(character, non_ASCII_space_characters) || inRange(character, prohibited_characters) || inRange(character, non_ASCII_controls_characters) || inRange(character, non_character_codepoints); // prettier-ignore-start
|
|
730
730
|
|
|
731
|
-
/**
|
|
732
|
-
* D.1 Characters with bidirectional property "R" or "AL"
|
|
733
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-D.1
|
|
731
|
+
/**
|
|
732
|
+
* D.1 Characters with bidirectional property "R" or "AL"
|
|
733
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-D.1
|
|
734
734
|
*/
|
|
735
735
|
|
|
736
736
|
|
|
@@ -738,9 +738,9 @@ var bidirectional_r_al = [0x05be, 0x05be, 0x05c0, 0x05c0, 0x05c3, 0x05c3, 0x05d0
|
|
|
738
738
|
|
|
739
739
|
var isBidirectionalRAL = character => inRange(character, bidirectional_r_al); // prettier-ignore-start
|
|
740
740
|
|
|
741
|
-
/**
|
|
742
|
-
* D.2 Characters with bidirectional property "L"
|
|
743
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-D.2
|
|
741
|
+
/**
|
|
742
|
+
* D.2 Characters with bidirectional property "L"
|
|
743
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-D.2
|
|
744
744
|
*/
|
|
745
745
|
|
|
746
746
|
|
|
@@ -748,15 +748,15 @@ var bidirectional_l = [0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0
|
|
|
748
748
|
|
|
749
749
|
var isBidirectionalL = character => inRange(character, bidirectional_l);
|
|
750
750
|
|
|
751
|
-
/**
|
|
752
|
-
* non-ASCII space characters [StringPrep, C.1.2] that can be
|
|
753
|
-
* mapped to SPACE (U+0020)
|
|
751
|
+
/**
|
|
752
|
+
* non-ASCII space characters [StringPrep, C.1.2] that can be
|
|
753
|
+
* mapped to SPACE (U+0020)
|
|
754
754
|
*/
|
|
755
755
|
|
|
756
756
|
var mapping2space = isNonASCIISpaceCharacter;
|
|
757
|
-
/**
|
|
758
|
-
* the "commonly mapped to nothing" characters [StringPrep, B.1]
|
|
759
|
-
* that can be mapped to nothing.
|
|
757
|
+
/**
|
|
758
|
+
* the "commonly mapped to nothing" characters [StringPrep, B.1]
|
|
759
|
+
* that can be mapped to nothing.
|
|
760
760
|
*/
|
|
761
761
|
|
|
762
762
|
var mapping2nothing = isCommonlyMappedToNothing; // utils
|
|
@@ -766,12 +766,12 @@ var getCodePoint = character => character.codePointAt(0);
|
|
|
766
766
|
var first = x => x[0];
|
|
767
767
|
|
|
768
768
|
var last = x => x[x.length - 1];
|
|
769
|
-
/**
|
|
770
|
-
* Convert provided string into an array of Unicode Code Points.
|
|
771
|
-
* Based on https://stackoverflow.com/a/21409165/1556249
|
|
772
|
-
* and https://www.npmjs.com/package/code-point-at.
|
|
773
|
-
* @param {string} input
|
|
774
|
-
* @returns {number[]}
|
|
769
|
+
/**
|
|
770
|
+
* Convert provided string into an array of Unicode Code Points.
|
|
771
|
+
* Based on https://stackoverflow.com/a/21409165/1556249
|
|
772
|
+
* and https://www.npmjs.com/package/code-point-at.
|
|
773
|
+
* @param {string} input
|
|
774
|
+
* @returns {number[]}
|
|
775
775
|
*/
|
|
776
776
|
|
|
777
777
|
|
|
@@ -797,12 +797,12 @@ function toCodePoints(input) {
|
|
|
797
797
|
|
|
798
798
|
return codepoints;
|
|
799
799
|
}
|
|
800
|
-
/**
|
|
801
|
-
* SASLprep.
|
|
802
|
-
* @param {string} input
|
|
803
|
-
* @param {Object} opts
|
|
804
|
-
* @param {boolean} opts.allowUnassigned
|
|
805
|
-
* @returns {string}
|
|
800
|
+
/**
|
|
801
|
+
* SASLprep.
|
|
802
|
+
* @param {string} input
|
|
803
|
+
* @param {Object} opts
|
|
804
|
+
* @param {boolean} opts.allowUnassigned
|
|
805
|
+
* @returns {string}
|
|
806
806
|
*/
|
|
807
807
|
|
|
808
808
|
|
|
@@ -848,10 +848,10 @@ function saslprep(input) {
|
|
|
848
848
|
if (hasBidiRAL && hasBidiL) {
|
|
849
849
|
throw new Error('String must not contain RandALCat and LCat at the same time,' + ' see https://tools.ietf.org/html/rfc3454#section-6');
|
|
850
850
|
}
|
|
851
|
-
/**
|
|
852
|
-
* 4.2 If a string contains any RandALCat character, a RandALCat
|
|
853
|
-
* character MUST be the first character of the string, and a
|
|
854
|
-
* RandALCat character MUST be the last character of the string.
|
|
851
|
+
/**
|
|
852
|
+
* 4.2 If a string contains any RandALCat character, a RandALCat
|
|
853
|
+
* character MUST be the first character of the string, and a
|
|
854
|
+
* RandALCat character MUST be the last character of the string.
|
|
855
855
|
*/
|
|
856
856
|
|
|
857
857
|
|
|
@@ -865,9 +865,9 @@ function saslprep(input) {
|
|
|
865
865
|
return normalized_input;
|
|
866
866
|
}
|
|
867
867
|
|
|
868
|
-
/*
|
|
869
|
-
PDFSecurity - represents PDF security settings
|
|
870
|
-
By Yang Liu <hi@zesik.com>
|
|
868
|
+
/*
|
|
869
|
+
PDFSecurity - represents PDF security settings
|
|
870
|
+
By Yang Liu <hi@zesik.com>
|
|
871
871
|
*/
|
|
872
872
|
|
|
873
873
|
class PDFSecurity {
|
|
@@ -4421,9 +4421,9 @@ class PNGImage {
|
|
|
4421
4421
|
|
|
4422
4422
|
}
|
|
4423
4423
|
|
|
4424
|
-
/*
|
|
4425
|
-
PDFImage - embeds images in PDF documents
|
|
4426
|
-
By Devon Govett
|
|
4424
|
+
/*
|
|
4425
|
+
PDFImage - embeds images in PDF documents
|
|
4426
|
+
By Devon Govett
|
|
4427
4427
|
*/
|
|
4428
4428
|
|
|
4429
4429
|
class PDFImage {
|
|
@@ -4913,9 +4913,9 @@ function _objectSpread2(target) {
|
|
|
4913
4913
|
return target;
|
|
4914
4914
|
}
|
|
4915
4915
|
|
|
4916
|
-
/*
|
|
4917
|
-
PDFStructureContent - a reference to a marked structure content
|
|
4918
|
-
By Ben Schmidt
|
|
4916
|
+
/*
|
|
4917
|
+
PDFStructureContent - a reference to a marked structure content
|
|
4918
|
+
By Ben Schmidt
|
|
4919
4919
|
*/
|
|
4920
4920
|
class PDFStructureContent {
|
|
4921
4921
|
constructor(pageRef, mcid) {
|
|
@@ -4931,9 +4931,9 @@ class PDFStructureContent {
|
|
|
4931
4931
|
|
|
4932
4932
|
}
|
|
4933
4933
|
|
|
4934
|
-
/*
|
|
4935
|
-
PDFStructureElement - represents an element in the PDF logical structure tree
|
|
4936
|
-
By Ben Schmidt
|
|
4934
|
+
/*
|
|
4935
|
+
PDFStructureElement - represents an element in the PDF logical structure tree
|
|
4936
|
+
By Ben Schmidt
|
|
4937
4937
|
*/
|
|
4938
4938
|
|
|
4939
4939
|
class PDFStructureElement {
|
|
@@ -5152,8 +5152,8 @@ class PDFStructureElement {
|
|
|
5152
5152
|
|
|
5153
5153
|
}
|
|
5154
5154
|
|
|
5155
|
-
/*
|
|
5156
|
-
PDFNumberTree - represents a number tree object
|
|
5155
|
+
/*
|
|
5156
|
+
PDFNumberTree - represents a number tree object
|
|
5157
5157
|
*/
|
|
5158
5158
|
|
|
5159
5159
|
class PDFNumberTree extends PDFTree {
|
|
@@ -5402,9 +5402,9 @@ var FORMAT_DEFAULT = {
|
|
|
5402
5402
|
}
|
|
5403
5403
|
};
|
|
5404
5404
|
var AcroFormMixin = {
|
|
5405
|
-
/**
|
|
5406
|
-
* Must call if adding AcroForms to a document. Must also call font() before
|
|
5407
|
-
* this method to set the default font.
|
|
5405
|
+
/**
|
|
5406
|
+
* Must call if adding AcroForms to a document. Must also call font() before
|
|
5407
|
+
* this method to set the default font.
|
|
5408
5408
|
*/
|
|
5409
5409
|
initForm() {
|
|
5410
5410
|
if (!this._font) {
|
|
@@ -5430,8 +5430,8 @@ var AcroFormMixin = {
|
|
|
5430
5430
|
return this;
|
|
5431
5431
|
},
|
|
5432
5432
|
|
|
5433
|
-
/**
|
|
5434
|
-
* Called automatically by document.js
|
|
5433
|
+
/**
|
|
5434
|
+
* Called automatically by document.js
|
|
5435
5435
|
*/
|
|
5436
5436
|
endAcroForm() {
|
|
5437
5437
|
if (this._root.data.AcroForm) {
|
|
@@ -5465,12 +5465,12 @@ var AcroFormMixin = {
|
|
|
5465
5465
|
return this;
|
|
5466
5466
|
},
|
|
5467
5467
|
|
|
5468
|
-
/**
|
|
5469
|
-
* Creates and adds a form field to the document. Form fields are intermediate
|
|
5470
|
-
* nodes in a PDF form that are used to specify form name heirarchy and form
|
|
5471
|
-
* value defaults.
|
|
5472
|
-
* @param {string} name - field name (T attribute in field dictionary)
|
|
5473
|
-
* @param {object} options - other attributes to include in field dictionary
|
|
5468
|
+
/**
|
|
5469
|
+
* Creates and adds a form field to the document. Form fields are intermediate
|
|
5470
|
+
* nodes in a PDF form that are used to specify form name heirarchy and form
|
|
5471
|
+
* value defaults.
|
|
5472
|
+
* @param {string} name - field name (T attribute in field dictionary)
|
|
5473
|
+
* @param {object} options - other attributes to include in field dictionary
|
|
5474
5474
|
*/
|
|
5475
5475
|
formField(name) {
|
|
5476
5476
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -5484,16 +5484,16 @@ var AcroFormMixin = {
|
|
|
5484
5484
|
return fieldRef;
|
|
5485
5485
|
},
|
|
5486
5486
|
|
|
5487
|
-
/**
|
|
5488
|
-
* Creates and adds a Form Annotation to the document. Form annotations are
|
|
5489
|
-
* called Widget annotations internally within a PDF file.
|
|
5490
|
-
* @param {string} name - form field name (T attribute of widget annotation
|
|
5491
|
-
* dictionary)
|
|
5492
|
-
* @param {number} x
|
|
5493
|
-
* @param {number} y
|
|
5494
|
-
* @param {number} w
|
|
5495
|
-
* @param {number} h
|
|
5496
|
-
* @param {object} options
|
|
5487
|
+
/**
|
|
5488
|
+
* Creates and adds a Form Annotation to the document. Form annotations are
|
|
5489
|
+
* called Widget annotations internally within a PDF file.
|
|
5490
|
+
* @param {string} name - form field name (T attribute of widget annotation
|
|
5491
|
+
* dictionary)
|
|
5492
|
+
* @param {number} x
|
|
5493
|
+
* @param {number} y
|
|
5494
|
+
* @param {number} w
|
|
5495
|
+
* @param {number} h
|
|
5496
|
+
* @param {object} options
|
|
5497
5497
|
*/
|
|
5498
5498
|
formAnnotation(name, type, x, y, w, h) {
|
|
5499
5499
|
var options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
|
|
@@ -5790,17 +5790,17 @@ var AcroFormMixin = {
|
|
|
5790
5790
|
};
|
|
5791
5791
|
|
|
5792
5792
|
var AttachmentsMixin = {
|
|
5793
|
-
/**
|
|
5794
|
-
* Embed contents of `src` in PDF
|
|
5795
|
-
* @param {Buffer | ArrayBuffer | string} src input Buffer, ArrayBuffer, base64 encoded string or path to file
|
|
5796
|
-
* @param {object} options
|
|
5797
|
-
* * options.name: filename to be shown in PDF, will use `src` if none set
|
|
5798
|
-
* * options.type: filetype to be shown in PDF
|
|
5799
|
-
* * options.description: description to be shown in PDF
|
|
5800
|
-
* * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
|
|
5801
|
-
* * options.creationDate: override creation date
|
|
5802
|
-
* * options.modifiedDate: override modified date
|
|
5803
|
-
* @returns filespec reference
|
|
5793
|
+
/**
|
|
5794
|
+
* Embed contents of `src` in PDF
|
|
5795
|
+
* @param {Buffer | ArrayBuffer | string} src input Buffer, ArrayBuffer, base64 encoded string or path to file
|
|
5796
|
+
* @param {object} options
|
|
5797
|
+
* * options.name: filename to be shown in PDF, will use `src` if none set
|
|
5798
|
+
* * options.type: filetype to be shown in PDF
|
|
5799
|
+
* * options.description: description to be shown in PDF
|
|
5800
|
+
* * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
|
|
5801
|
+
* * options.creationDate: override creation date
|
|
5802
|
+
* * options.modifiedDate: override modified date
|
|
5803
|
+
* @returns filespec reference
|
|
5804
5804
|
*/
|
|
5805
5805
|
file(src) {
|
|
5806
5806
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -5914,9 +5914,9 @@ function isEqual(a, b) {
|
|
|
5914
5914
|
return true;
|
|
5915
5915
|
}
|
|
5916
5916
|
|
|
5917
|
-
/*
|
|
5918
|
-
PDFDocument - represents an entire PDF document
|
|
5919
|
-
By Devon Govett
|
|
5917
|
+
/*
|
|
5918
|
+
PDFDocument - represents an entire PDF document
|
|
5919
|
+
By Devon Govett
|
|
5920
5920
|
*/
|
|
5921
5921
|
|
|
5922
5922
|
class PDFDocument extends stream.Readable {
|