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.js
CHANGED
|
@@ -9,8 +9,8 @@ var events = require('events');
|
|
|
9
9
|
var LineBreaker = require('linebreak');
|
|
10
10
|
var PNG = require('png-js');
|
|
11
11
|
|
|
12
|
-
/*
|
|
13
|
-
PDFAbstractReference - abstract class for PDF reference
|
|
12
|
+
/*
|
|
13
|
+
PDFAbstractReference - abstract class for PDF reference
|
|
14
14
|
*/
|
|
15
15
|
class PDFAbstractReference {
|
|
16
16
|
toString() {
|
|
@@ -19,8 +19,8 @@ class PDFAbstractReference {
|
|
|
19
19
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/*
|
|
23
|
-
PDFTree - abstract base class for name and number tree objects
|
|
22
|
+
/*
|
|
23
|
+
PDFTree - abstract base class for name and number tree objects
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
class PDFTree {
|
|
@@ -78,9 +78,9 @@ class PDFTree {
|
|
|
78
78
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
/*
|
|
82
|
-
PDFObject - converts JavaScript types into their corresponding PDF types.
|
|
83
|
-
By Devon Govett
|
|
81
|
+
/*
|
|
82
|
+
PDFObject - converts JavaScript types into their corresponding PDF types.
|
|
83
|
+
By Devon Govett
|
|
84
84
|
*/
|
|
85
85
|
|
|
86
86
|
const pad = (str, length) => (Array(length + 1).join('0') + str).slice(-length);
|
|
@@ -193,9 +193,9 @@ class PDFObject {
|
|
|
193
193
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
/*
|
|
197
|
-
PDFReference - represents a reference to another object in the PDF object heirarchy
|
|
198
|
-
By Devon Govett
|
|
196
|
+
/*
|
|
197
|
+
PDFReference - represents a reference to another object in the PDF object heirarchy
|
|
198
|
+
By Devon Govett
|
|
199
199
|
*/
|
|
200
200
|
|
|
201
201
|
class PDFReference extends PDFAbstractReference {
|
|
@@ -280,9 +280,9 @@ class PDFReference extends PDFAbstractReference {
|
|
|
280
280
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
/*
|
|
284
|
-
PDFPage - represents a single page in the PDF document
|
|
285
|
-
By Devon Govett
|
|
283
|
+
/*
|
|
284
|
+
PDFPage - represents a single page in the PDF document
|
|
285
|
+
By Devon Govett
|
|
286
286
|
*/
|
|
287
287
|
const DEFAULT_MARGINS = {
|
|
288
288
|
top: 72,
|
|
@@ -427,8 +427,8 @@ class PDFPage {
|
|
|
427
427
|
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
/*
|
|
431
|
-
PDFNameTree - represents a name tree object
|
|
430
|
+
/*
|
|
431
|
+
PDFNameTree - represents a name tree object
|
|
432
432
|
*/
|
|
433
433
|
|
|
434
434
|
class PDFNameTree extends PDFTree {
|
|
@@ -446,11 +446,11 @@ class PDFNameTree extends PDFTree {
|
|
|
446
446
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
/**
|
|
450
|
-
* Check if value is in a range group.
|
|
451
|
-
* @param {number} value
|
|
452
|
-
* @param {number[]} rangeGroup
|
|
453
|
-
* @returns {boolean}
|
|
449
|
+
/**
|
|
450
|
+
* Check if value is in a range group.
|
|
451
|
+
* @param {number} value
|
|
452
|
+
* @param {number[]} rangeGroup
|
|
453
|
+
* @returns {boolean}
|
|
454
454
|
*/
|
|
455
455
|
function inRange(value, rangeGroup) {
|
|
456
456
|
if (value < rangeGroup[0]) return false;
|
|
@@ -478,18 +478,18 @@ function inRange(value, rangeGroup) {
|
|
|
478
478
|
return false;
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
/**
|
|
482
|
-
* A.1 Unassigned code points in Unicode 3.2
|
|
483
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-A.1
|
|
481
|
+
/**
|
|
482
|
+
* A.1 Unassigned code points in Unicode 3.2
|
|
483
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-A.1
|
|
484
484
|
*/
|
|
485
485
|
|
|
486
486
|
const 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
|
|
487
487
|
|
|
488
488
|
const isUnassignedCodePoint = character => inRange(character, unassigned_code_points); // prettier-ignore-start
|
|
489
489
|
|
|
490
|
-
/**
|
|
491
|
-
* B.1 Commonly mapped to nothing
|
|
492
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-B.1
|
|
490
|
+
/**
|
|
491
|
+
* B.1 Commonly mapped to nothing
|
|
492
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-B.1
|
|
493
493
|
*/
|
|
494
494
|
|
|
495
495
|
|
|
@@ -497,9 +497,9 @@ const commonly_mapped_to_nothing = [0x00ad, 0x00ad, 0x034f, 0x034f, 0x1806, 0x18
|
|
|
497
497
|
|
|
498
498
|
const isCommonlyMappedToNothing = character => inRange(character, commonly_mapped_to_nothing); // prettier-ignore-start
|
|
499
499
|
|
|
500
|
-
/**
|
|
501
|
-
* C.1.2 Non-ASCII space characters
|
|
502
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2
|
|
500
|
+
/**
|
|
501
|
+
* C.1.2 Non-ASCII space characters
|
|
502
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2
|
|
503
503
|
*/
|
|
504
504
|
|
|
505
505
|
|
|
@@ -543,9 +543,9 @@ const isNonASCIISpaceCharacter = character => inRange(character, non_ASCII_space
|
|
|
543
543
|
|
|
544
544
|
|
|
545
545
|
const non_ASCII_controls_characters = [
|
|
546
|
-
/**
|
|
547
|
-
* C.2.2 Non-ASCII control characters
|
|
548
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2
|
|
546
|
+
/**
|
|
547
|
+
* C.2.2 Non-ASCII control characters
|
|
548
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2
|
|
549
549
|
*/
|
|
550
550
|
0x0080, 0x009f
|
|
551
551
|
/* [CONTROL CHARACTERS] */
|
|
@@ -581,9 +581,9 @@ const non_ASCII_controls_characters = [
|
|
|
581
581
|
/* [MUSICAL CONTROL CHARACTERS] */
|
|
582
582
|
];
|
|
583
583
|
const non_character_codepoints = [
|
|
584
|
-
/**
|
|
585
|
-
* C.4 Non-character code points
|
|
586
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.4
|
|
584
|
+
/**
|
|
585
|
+
* C.4 Non-character code points
|
|
586
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.4
|
|
587
587
|
*/
|
|
588
588
|
0xfdd0, 0xfdef
|
|
589
589
|
/* [NONCHARACTER CODE POINTS] */
|
|
@@ -620,23 +620,23 @@ const non_character_codepoints = [
|
|
|
620
620
|
, 0x10fffe, 0x10ffff
|
|
621
621
|
/* [NONCHARACTER CODE POINTS] */
|
|
622
622
|
];
|
|
623
|
-
/**
|
|
624
|
-
* 2.3. Prohibited Output
|
|
623
|
+
/**
|
|
624
|
+
* 2.3. Prohibited Output
|
|
625
625
|
*/
|
|
626
626
|
|
|
627
627
|
const prohibited_characters = [
|
|
628
|
-
/**
|
|
629
|
-
* C.2.1 ASCII control characters
|
|
630
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1
|
|
628
|
+
/**
|
|
629
|
+
* C.2.1 ASCII control characters
|
|
630
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1
|
|
631
631
|
*/
|
|
632
632
|
0, 0x001f
|
|
633
633
|
/* [CONTROL CHARACTERS] */
|
|
634
634
|
, 0x007f, 0x007f
|
|
635
635
|
/* DELETE */
|
|
636
636
|
,
|
|
637
|
-
/**
|
|
638
|
-
* C.8 Change display properties or are deprecated
|
|
639
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.8
|
|
637
|
+
/**
|
|
638
|
+
* C.8 Change display properties or are deprecated
|
|
639
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.8
|
|
640
640
|
*/
|
|
641
641
|
0x0340, 0x0340
|
|
642
642
|
/* COMBINING GRAVE TONE MARK */
|
|
@@ -669,28 +669,28 @@ const prohibited_characters = [
|
|
|
669
669
|
, 0x206f, 0x206f
|
|
670
670
|
/* NOMINAL DIGIT SHAPES */
|
|
671
671
|
,
|
|
672
|
-
/**
|
|
673
|
-
* C.7 Inappropriate for canonical representation
|
|
674
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.7
|
|
672
|
+
/**
|
|
673
|
+
* C.7 Inappropriate for canonical representation
|
|
674
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.7
|
|
675
675
|
*/
|
|
676
676
|
0x2ff0, 0x2ffb
|
|
677
677
|
/* [IDEOGRAPHIC DESCRIPTION CHARACTERS] */
|
|
678
678
|
,
|
|
679
|
-
/**
|
|
680
|
-
* C.5 Surrogate codes
|
|
681
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.5
|
|
679
|
+
/**
|
|
680
|
+
* C.5 Surrogate codes
|
|
681
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.5
|
|
682
682
|
*/
|
|
683
683
|
0xd800, 0xdfff,
|
|
684
|
-
/**
|
|
685
|
-
* C.3 Private use
|
|
686
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
684
|
+
/**
|
|
685
|
+
* C.3 Private use
|
|
686
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
687
687
|
*/
|
|
688
688
|
0xe000, 0xf8ff
|
|
689
689
|
/* [PRIVATE USE, PLANE 0] */
|
|
690
690
|
,
|
|
691
|
-
/**
|
|
692
|
-
* C.6 Inappropriate for plain text
|
|
693
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.6
|
|
691
|
+
/**
|
|
692
|
+
* C.6 Inappropriate for plain text
|
|
693
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.6
|
|
694
694
|
*/
|
|
695
695
|
0xfff9, 0xfff9
|
|
696
696
|
/* INTERLINEAR ANNOTATION ANCHOR */
|
|
@@ -703,18 +703,18 @@ const prohibited_characters = [
|
|
|
703
703
|
, 0xfffd, 0xfffd
|
|
704
704
|
/* REPLACEMENT CHARACTER */
|
|
705
705
|
,
|
|
706
|
-
/**
|
|
707
|
-
* C.9 Tagging characters
|
|
708
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.9
|
|
706
|
+
/**
|
|
707
|
+
* C.9 Tagging characters
|
|
708
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.9
|
|
709
709
|
*/
|
|
710
710
|
0xe0001, 0xe0001
|
|
711
711
|
/* LANGUAGE TAG */
|
|
712
712
|
, 0xe0020, 0xe007f
|
|
713
713
|
/* [TAGGING CHARACTERS] */
|
|
714
714
|
,
|
|
715
|
-
/**
|
|
716
|
-
* C.3 Private use
|
|
717
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
715
|
+
/**
|
|
716
|
+
* C.3 Private use
|
|
717
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-C.3
|
|
718
718
|
*/
|
|
719
719
|
0xf0000, 0xffffd
|
|
720
720
|
/* [PRIVATE USE, PLANE 15] */
|
|
@@ -724,9 +724,9 @@ const prohibited_characters = [
|
|
|
724
724
|
|
|
725
725
|
const 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
|
|
726
726
|
|
|
727
|
-
/**
|
|
728
|
-
* D.1 Characters with bidirectional property "R" or "AL"
|
|
729
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-D.1
|
|
727
|
+
/**
|
|
728
|
+
* D.1 Characters with bidirectional property "R" or "AL"
|
|
729
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-D.1
|
|
730
730
|
*/
|
|
731
731
|
|
|
732
732
|
|
|
@@ -734,9 +734,9 @@ const bidirectional_r_al = [0x05be, 0x05be, 0x05c0, 0x05c0, 0x05c3, 0x05c3, 0x05
|
|
|
734
734
|
|
|
735
735
|
const isBidirectionalRAL = character => inRange(character, bidirectional_r_al); // prettier-ignore-start
|
|
736
736
|
|
|
737
|
-
/**
|
|
738
|
-
* D.2 Characters with bidirectional property "L"
|
|
739
|
-
* @link https://tools.ietf.org/html/rfc3454#appendix-D.2
|
|
737
|
+
/**
|
|
738
|
+
* D.2 Characters with bidirectional property "L"
|
|
739
|
+
* @link https://tools.ietf.org/html/rfc3454#appendix-D.2
|
|
740
740
|
*/
|
|
741
741
|
|
|
742
742
|
|
|
@@ -744,15 +744,15 @@ const bidirectional_l = [0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5,
|
|
|
744
744
|
|
|
745
745
|
const isBidirectionalL = character => inRange(character, bidirectional_l);
|
|
746
746
|
|
|
747
|
-
/**
|
|
748
|
-
* non-ASCII space characters [StringPrep, C.1.2] that can be
|
|
749
|
-
* mapped to SPACE (U+0020)
|
|
747
|
+
/**
|
|
748
|
+
* non-ASCII space characters [StringPrep, C.1.2] that can be
|
|
749
|
+
* mapped to SPACE (U+0020)
|
|
750
750
|
*/
|
|
751
751
|
|
|
752
752
|
const mapping2space = isNonASCIISpaceCharacter;
|
|
753
|
-
/**
|
|
754
|
-
* the "commonly mapped to nothing" characters [StringPrep, B.1]
|
|
755
|
-
* that can be mapped to nothing.
|
|
753
|
+
/**
|
|
754
|
+
* the "commonly mapped to nothing" characters [StringPrep, B.1]
|
|
755
|
+
* that can be mapped to nothing.
|
|
756
756
|
*/
|
|
757
757
|
|
|
758
758
|
const mapping2nothing = isCommonlyMappedToNothing; // utils
|
|
@@ -762,12 +762,12 @@ const getCodePoint = character => character.codePointAt(0);
|
|
|
762
762
|
const first = x => x[0];
|
|
763
763
|
|
|
764
764
|
const last = x => x[x.length - 1];
|
|
765
|
-
/**
|
|
766
|
-
* Convert provided string into an array of Unicode Code Points.
|
|
767
|
-
* Based on https://stackoverflow.com/a/21409165/1556249
|
|
768
|
-
* and https://www.npmjs.com/package/code-point-at.
|
|
769
|
-
* @param {string} input
|
|
770
|
-
* @returns {number[]}
|
|
765
|
+
/**
|
|
766
|
+
* Convert provided string into an array of Unicode Code Points.
|
|
767
|
+
* Based on https://stackoverflow.com/a/21409165/1556249
|
|
768
|
+
* and https://www.npmjs.com/package/code-point-at.
|
|
769
|
+
* @param {string} input
|
|
770
|
+
* @returns {number[]}
|
|
771
771
|
*/
|
|
772
772
|
|
|
773
773
|
|
|
@@ -793,12 +793,12 @@ function toCodePoints(input) {
|
|
|
793
793
|
|
|
794
794
|
return codepoints;
|
|
795
795
|
}
|
|
796
|
-
/**
|
|
797
|
-
* SASLprep.
|
|
798
|
-
* @param {string} input
|
|
799
|
-
* @param {Object} opts
|
|
800
|
-
* @param {boolean} opts.allowUnassigned
|
|
801
|
-
* @returns {string}
|
|
796
|
+
/**
|
|
797
|
+
* SASLprep.
|
|
798
|
+
* @param {string} input
|
|
799
|
+
* @param {Object} opts
|
|
800
|
+
* @param {boolean} opts.allowUnassigned
|
|
801
|
+
* @returns {string}
|
|
802
802
|
*/
|
|
803
803
|
|
|
804
804
|
|
|
@@ -842,10 +842,10 @@ function saslprep(input, opts = {}) {
|
|
|
842
842
|
if (hasBidiRAL && hasBidiL) {
|
|
843
843
|
throw new Error('String must not contain RandALCat and LCat at the same time,' + ' see https://tools.ietf.org/html/rfc3454#section-6');
|
|
844
844
|
}
|
|
845
|
-
/**
|
|
846
|
-
* 4.2 If a string contains any RandALCat character, a RandALCat
|
|
847
|
-
* character MUST be the first character of the string, and a
|
|
848
|
-
* RandALCat character MUST be the last character of the string.
|
|
845
|
+
/**
|
|
846
|
+
* 4.2 If a string contains any RandALCat character, a RandALCat
|
|
847
|
+
* character MUST be the first character of the string, and a
|
|
848
|
+
* RandALCat character MUST be the last character of the string.
|
|
849
849
|
*/
|
|
850
850
|
|
|
851
851
|
|
|
@@ -859,9 +859,9 @@ function saslprep(input, opts = {}) {
|
|
|
859
859
|
return normalized_input;
|
|
860
860
|
}
|
|
861
861
|
|
|
862
|
-
/*
|
|
863
|
-
PDFSecurity - represents PDF security settings
|
|
864
|
-
By Yang Liu <hi@zesik.com>
|
|
862
|
+
/*
|
|
863
|
+
PDFSecurity - represents PDF security settings
|
|
864
|
+
By Yang Liu <hi@zesik.com>
|
|
865
865
|
*/
|
|
866
866
|
|
|
867
867
|
class PDFSecurity {
|
|
@@ -4482,9 +4482,9 @@ class PNGImage {
|
|
|
4482
4482
|
|
|
4483
4483
|
}
|
|
4484
4484
|
|
|
4485
|
-
/*
|
|
4486
|
-
PDFImage - embeds images in PDF documents
|
|
4487
|
-
By Devon Govett
|
|
4485
|
+
/*
|
|
4486
|
+
PDFImage - embeds images in PDF documents
|
|
4487
|
+
By Devon Govett
|
|
4488
4488
|
*/
|
|
4489
4489
|
|
|
4490
4490
|
class PDFImage {
|
|
@@ -4957,9 +4957,9 @@ function _objectSpread2(target) {
|
|
|
4957
4957
|
return target;
|
|
4958
4958
|
}
|
|
4959
4959
|
|
|
4960
|
-
/*
|
|
4961
|
-
PDFStructureContent - a reference to a marked structure content
|
|
4962
|
-
By Ben Schmidt
|
|
4960
|
+
/*
|
|
4961
|
+
PDFStructureContent - a reference to a marked structure content
|
|
4962
|
+
By Ben Schmidt
|
|
4963
4963
|
*/
|
|
4964
4964
|
class PDFStructureContent {
|
|
4965
4965
|
constructor(pageRef, mcid) {
|
|
@@ -4975,9 +4975,9 @@ class PDFStructureContent {
|
|
|
4975
4975
|
|
|
4976
4976
|
}
|
|
4977
4977
|
|
|
4978
|
-
/*
|
|
4979
|
-
PDFStructureElement - represents an element in the PDF logical structure tree
|
|
4980
|
-
By Ben Schmidt
|
|
4978
|
+
/*
|
|
4979
|
+
PDFStructureElement - represents an element in the PDF logical structure tree
|
|
4980
|
+
By Ben Schmidt
|
|
4981
4981
|
*/
|
|
4982
4982
|
|
|
4983
4983
|
class PDFStructureElement {
|
|
@@ -5191,8 +5191,8 @@ class PDFStructureElement {
|
|
|
5191
5191
|
|
|
5192
5192
|
}
|
|
5193
5193
|
|
|
5194
|
-
/*
|
|
5195
|
-
PDFNumberTree - represents a number tree object
|
|
5194
|
+
/*
|
|
5195
|
+
PDFNumberTree - represents a number tree object
|
|
5196
5196
|
*/
|
|
5197
5197
|
|
|
5198
5198
|
class PDFNumberTree extends PDFTree {
|
|
@@ -5436,9 +5436,9 @@ const FORMAT_DEFAULT = {
|
|
|
5436
5436
|
}
|
|
5437
5437
|
};
|
|
5438
5438
|
var AcroFormMixin = {
|
|
5439
|
-
/**
|
|
5440
|
-
* Must call if adding AcroForms to a document. Must also call font() before
|
|
5441
|
-
* this method to set the default font.
|
|
5439
|
+
/**
|
|
5440
|
+
* Must call if adding AcroForms to a document. Must also call font() before
|
|
5441
|
+
* this method to set the default font.
|
|
5442
5442
|
*/
|
|
5443
5443
|
initForm() {
|
|
5444
5444
|
if (!this._font) {
|
|
@@ -5464,8 +5464,8 @@ var AcroFormMixin = {
|
|
|
5464
5464
|
return this;
|
|
5465
5465
|
},
|
|
5466
5466
|
|
|
5467
|
-
/**
|
|
5468
|
-
* Called automatically by document.js
|
|
5467
|
+
/**
|
|
5468
|
+
* Called automatically by document.js
|
|
5469
5469
|
*/
|
|
5470
5470
|
endAcroForm() {
|
|
5471
5471
|
if (this._root.data.AcroForm) {
|
|
@@ -5499,12 +5499,12 @@ var AcroFormMixin = {
|
|
|
5499
5499
|
return this;
|
|
5500
5500
|
},
|
|
5501
5501
|
|
|
5502
|
-
/**
|
|
5503
|
-
* Creates and adds a form field to the document. Form fields are intermediate
|
|
5504
|
-
* nodes in a PDF form that are used to specify form name heirarchy and form
|
|
5505
|
-
* value defaults.
|
|
5506
|
-
* @param {string} name - field name (T attribute in field dictionary)
|
|
5507
|
-
* @param {object} options - other attributes to include in field dictionary
|
|
5502
|
+
/**
|
|
5503
|
+
* Creates and adds a form field to the document. Form fields are intermediate
|
|
5504
|
+
* nodes in a PDF form that are used to specify form name heirarchy and form
|
|
5505
|
+
* value defaults.
|
|
5506
|
+
* @param {string} name - field name (T attribute in field dictionary)
|
|
5507
|
+
* @param {object} options - other attributes to include in field dictionary
|
|
5508
5508
|
*/
|
|
5509
5509
|
formField(name, options = {}) {
|
|
5510
5510
|
let fieldDict = this._fieldDict(name, null, options);
|
|
@@ -5516,16 +5516,16 @@ var AcroFormMixin = {
|
|
|
5516
5516
|
return fieldRef;
|
|
5517
5517
|
},
|
|
5518
5518
|
|
|
5519
|
-
/**
|
|
5520
|
-
* Creates and adds a Form Annotation to the document. Form annotations are
|
|
5521
|
-
* called Widget annotations internally within a PDF file.
|
|
5522
|
-
* @param {string} name - form field name (T attribute of widget annotation
|
|
5523
|
-
* dictionary)
|
|
5524
|
-
* @param {number} x
|
|
5525
|
-
* @param {number} y
|
|
5526
|
-
* @param {number} w
|
|
5527
|
-
* @param {number} h
|
|
5528
|
-
* @param {object} options
|
|
5519
|
+
/**
|
|
5520
|
+
* Creates and adds a Form Annotation to the document. Form annotations are
|
|
5521
|
+
* called Widget annotations internally within a PDF file.
|
|
5522
|
+
* @param {string} name - form field name (T attribute of widget annotation
|
|
5523
|
+
* dictionary)
|
|
5524
|
+
* @param {number} x
|
|
5525
|
+
* @param {number} y
|
|
5526
|
+
* @param {number} w
|
|
5527
|
+
* @param {number} h
|
|
5528
|
+
* @param {object} options
|
|
5529
5529
|
*/
|
|
5530
5530
|
formAnnotation(name, type, x, y, w, h, options = {}) {
|
|
5531
5531
|
let fieldDict = this._fieldDict(name, type, options);
|
|
@@ -5811,17 +5811,17 @@ var AcroFormMixin = {
|
|
|
5811
5811
|
};
|
|
5812
5812
|
|
|
5813
5813
|
var AttachmentsMixin = {
|
|
5814
|
-
/**
|
|
5815
|
-
* Embed contents of `src` in PDF
|
|
5816
|
-
* @param {Buffer | ArrayBuffer | string} src input Buffer, ArrayBuffer, base64 encoded string or path to file
|
|
5817
|
-
* @param {object} options
|
|
5818
|
-
* * options.name: filename to be shown in PDF, will use `src` if none set
|
|
5819
|
-
* * options.type: filetype to be shown in PDF
|
|
5820
|
-
* * options.description: description to be shown in PDF
|
|
5821
|
-
* * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
|
|
5822
|
-
* * options.creationDate: override creation date
|
|
5823
|
-
* * options.modifiedDate: override modified date
|
|
5824
|
-
* @returns filespec reference
|
|
5814
|
+
/**
|
|
5815
|
+
* Embed contents of `src` in PDF
|
|
5816
|
+
* @param {Buffer | ArrayBuffer | string} src input Buffer, ArrayBuffer, base64 encoded string or path to file
|
|
5817
|
+
* @param {object} options
|
|
5818
|
+
* * options.name: filename to be shown in PDF, will use `src` if none set
|
|
5819
|
+
* * options.type: filetype to be shown in PDF
|
|
5820
|
+
* * options.description: description to be shown in PDF
|
|
5821
|
+
* * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
|
|
5822
|
+
* * options.creationDate: override creation date
|
|
5823
|
+
* * options.modifiedDate: override modified date
|
|
5824
|
+
* @returns filespec reference
|
|
5825
5825
|
*/
|
|
5826
5826
|
file(src, options = {}) {
|
|
5827
5827
|
options.name = options.name || src;
|
|
@@ -5934,9 +5934,9 @@ function isEqual(a, b) {
|
|
|
5934
5934
|
return true;
|
|
5935
5935
|
}
|
|
5936
5936
|
|
|
5937
|
-
/*
|
|
5938
|
-
PDFDocument - represents an entire PDF document
|
|
5939
|
-
By Devon Govett
|
|
5937
|
+
/*
|
|
5938
|
+
PDFDocument - represents an entire PDF document
|
|
5939
|
+
By Devon Govett
|
|
5940
5940
|
*/
|
|
5941
5941
|
|
|
5942
5942
|
class PDFDocument extends stream.Readable {
|