pdf-codec 1.4.2 → 1.6.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/README.md +56 -15
- package/dist/assets/caladea-bold.cjs +5 -0
- package/dist/assets/caladea-bold.d.cts +4 -0
- package/dist/assets/caladea-bold.d.ts +4 -0
- package/dist/assets/caladea-bold.js +4 -0
- package/dist/assets/caladea-bolditalic.cjs +5 -0
- package/dist/assets/caladea-bolditalic.d.cts +4 -0
- package/dist/assets/caladea-bolditalic.d.ts +4 -0
- package/dist/assets/caladea-bolditalic.js +4 -0
- package/dist/assets/caladea-italic.cjs +5 -0
- package/dist/assets/caladea-italic.d.cts +4 -0
- package/dist/assets/caladea-italic.d.ts +4 -0
- package/dist/assets/caladea-italic.js +4 -0
- package/dist/assets/caladea-regular.cjs +5 -0
- package/dist/assets/caladea-regular.d.cts +4 -0
- package/dist/assets/caladea-regular.d.ts +4 -0
- package/dist/assets/caladea-regular.js +4 -0
- package/dist/assets/carlito-bold.cjs +5 -0
- package/dist/assets/carlito-bold.d.cts +4 -0
- package/dist/assets/carlito-bold.d.ts +4 -0
- package/dist/assets/carlito-bold.js +4 -0
- package/dist/assets/carlito-bolditalic.cjs +5 -0
- package/dist/assets/carlito-bolditalic.d.cts +4 -0
- package/dist/assets/carlito-bolditalic.d.ts +4 -0
- package/dist/assets/carlito-bolditalic.js +4 -0
- package/dist/assets/carlito-italic.cjs +5 -0
- package/dist/assets/carlito-italic.d.cts +4 -0
- package/dist/assets/carlito-italic.d.ts +4 -0
- package/dist/assets/carlito-italic.js +4 -0
- package/dist/assets/carlito-regular.cjs +5 -0
- package/dist/assets/carlito-regular.d.cts +4 -0
- package/dist/assets/carlito-regular.d.ts +4 -0
- package/dist/assets/carlito-regular.js +4 -0
- package/dist/cff-probe.cjs +133 -0
- package/dist/cff-probe.d.cts +10 -0
- package/dist/cff-probe.d.ts +10 -0
- package/dist/cff-probe.js +132 -0
- package/dist/cmap-table.cjs +108 -0
- package/dist/cmap-table.d.cts +6 -0
- package/dist/cmap-table.d.ts +6 -0
- package/dist/cmap-table.js +107 -0
- package/dist/content-write.cjs +36 -17
- package/dist/content-write.d.cts +9 -2
- package/dist/content-write.d.ts +9 -2
- package/dist/content-write.js +35 -16
- package/dist/crypto/aes.cjs +166 -0
- package/dist/crypto/aes.d.cts +6 -0
- package/dist/crypto/aes.d.ts +6 -0
- package/dist/crypto/aes.js +163 -0
- package/dist/crypto/md5.cjs +215 -0
- package/dist/crypto/md5.d.cts +4 -0
- package/dist/crypto/md5.d.ts +4 -0
- package/dist/crypto/md5.js +214 -0
- package/dist/crypto/rc4.cjs +29 -0
- package/dist/crypto/rc4.d.cts +4 -0
- package/dist/crypto/rc4.d.ts +4 -0
- package/dist/crypto/rc4.js +28 -0
- package/dist/crypto/sha2.cjs +261 -0
- package/dist/crypto/sha2.d.cts +6 -0
- package/dist/crypto/sha2.d.ts +6 -0
- package/dist/crypto/sha2.js +258 -0
- package/dist/diagnostics.cjs +7 -0
- package/dist/diagnostics.d.cts +4 -1
- package/dist/diagnostics.d.ts +4 -1
- package/dist/diagnostics.js +7 -1
- package/dist/document.cjs +38 -2
- package/dist/document.js +38 -2
- package/dist/embedded-font-CLedn-mT.d.cts +42 -0
- package/dist/embedded-font-CbqkKgBl.d.ts +42 -0
- package/dist/embedded-font-write.cjs +92 -0
- package/dist/embedded-font-write.d.cts +22 -0
- package/dist/embedded-font-write.d.ts +22 -0
- package/dist/embedded-font-write.js +90 -0
- package/dist/embedded-font.cjs +142 -0
- package/dist/embedded-font.d.cts +2 -0
- package/dist/embedded-font.d.ts +2 -0
- package/dist/embedded-font.js +138 -0
- package/dist/encrypt.cjs +264 -0
- package/dist/encrypt.d.cts +11 -0
- package/dist/encrypt.d.ts +11 -0
- package/dist/encrypt.js +263 -0
- package/dist/filters.cjs +19 -1
- package/dist/filters.js +19 -1
- package/dist/font-registry-Cn7P9lAh.d.ts +38 -0
- package/dist/font-registry-yby02snZ.d.cts +38 -0
- package/dist/font-registry.cjs +152 -0
- package/dist/font-registry.d.cts +2 -0
- package/dist/font-registry.d.ts +2 -0
- package/dist/font-registry.js +150 -0
- package/dist/font-substitutes.cjs +13 -0
- package/dist/font-substitutes.d.cts +5 -0
- package/dist/font-substitutes.d.ts +5 -0
- package/dist/font-substitutes.js +12 -0
- package/dist/font-tables.cjs +127 -0
- package/dist/font-tables.d.cts +43 -0
- package/dist/font-tables.d.ts +43 -0
- package/dist/font-tables.js +122 -0
- package/dist/fonts.cjs +1 -0
- package/dist/fonts.d.cts +2 -1
- package/dist/fonts.d.ts +2 -1
- package/dist/fonts.js +1 -1
- package/dist/glyf.cjs +127 -0
- package/dist/glyf.d.cts +31 -0
- package/dist/glyf.d.ts +31 -0
- package/dist/glyf.js +125 -0
- package/dist/{math-hmtx.cjs → hmtx-table.cjs} +3 -3
- package/dist/{math-hmtx.d.ts → hmtx-table.d.cts} +2 -2
- package/dist/{math-hmtx.d.cts → hmtx-table.d.ts} +2 -2
- package/dist/{math-hmtx.js → hmtx-table.js} +3 -3
- package/dist/image/ccitt.cjs +488 -0
- package/dist/image/ccitt.d.cts +17 -0
- package/dist/image/ccitt.d.ts +17 -0
- package/dist/image/ccitt.js +487 -0
- package/dist/images-read.cjs +1 -4
- package/dist/images-read.js +2 -5
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +5 -3
- package/dist/interpret.cjs +173 -38
- package/dist/interpret.d.cts +27 -10
- package/dist/interpret.d.ts +27 -10
- package/dist/interpret.js +174 -39
- package/dist/math-font-write.cjs +3 -32
- package/dist/math-font-write.js +2 -31
- package/dist/math-font.cjs +7 -5
- package/dist/math-font.js +5 -3
- package/dist/math-table.d.cts +1 -1
- package/dist/math-table.d.ts +1 -1
- package/dist/{matrix-B3c2_a2f.d.cts → matrix-BHzJESll.d.cts} +2 -1
- package/dist/{matrix-B3c2_a2f.d.ts → matrix-BHzJESll.d.ts} +2 -1
- package/dist/matrix.cjs +2 -0
- package/dist/matrix.d.cts +2 -2
- package/dist/matrix.d.ts +2 -2
- package/dist/matrix.js +2 -1
- package/dist/measure.cjs +65 -14
- package/dist/measure.d.cts +8 -1
- package/dist/measure.d.ts +8 -1
- package/dist/measure.js +64 -15
- package/dist/objects.cjs +4 -0
- package/dist/objects.d.cts +2 -1
- package/dist/objects.d.ts +2 -1
- package/dist/objects.js +4 -1
- package/dist/read.cjs +43 -4
- package/dist/read.d.cts +1 -1
- package/dist/read.d.ts +1 -1
- package/dist/read.js +43 -4
- package/dist/sfnt-V08bb5ut.d.cts +21 -0
- package/dist/sfnt-V08bb5ut.d.ts +21 -0
- package/dist/sfnt-subset.cjs +250 -0
- package/dist/sfnt-subset.d.cts +11 -0
- package/dist/sfnt-subset.d.ts +11 -0
- package/dist/sfnt-subset.js +249 -0
- package/dist/sfnt.cjs +50 -4
- package/dist/sfnt.d.cts +2 -17
- package/dist/sfnt.d.ts +2 -17
- package/dist/sfnt.js +47 -5
- package/dist/tounicode.cjs +34 -0
- package/dist/tounicode.d.cts +5 -0
- package/dist/tounicode.d.ts +5 -0
- package/dist/tounicode.js +33 -0
- package/dist/write.cjs +81 -11
- package/dist/write.d.cts +6 -0
- package/dist/write.d.ts +6 -0
- package/dist/write.js +82 -12
- package/package.json +1 -1
- package/dist/math-cmap.cjs +0 -81
- package/dist/math-cmap.d.cts +0 -6
- package/dist/math-cmap.d.ts +0 -6
- package/dist/math-cmap.js +0 -80
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import { concatBytes } from "../bytes/writer.js";
|
|
2
|
+
//#region src/image/ccitt.ts
|
|
3
|
+
const WHITE_TERMINATING_AND_MAKEUP = [
|
|
4
|
+
["00110101", 0],
|
|
5
|
+
["000111", 1],
|
|
6
|
+
["0111", 2],
|
|
7
|
+
["1000", 3],
|
|
8
|
+
["1011", 4],
|
|
9
|
+
["1100", 5],
|
|
10
|
+
["1110", 6],
|
|
11
|
+
["1111", 7],
|
|
12
|
+
["10011", 8],
|
|
13
|
+
["10100", 9],
|
|
14
|
+
["00111", 10],
|
|
15
|
+
["01000", 11],
|
|
16
|
+
["001000", 12],
|
|
17
|
+
["000011", 13],
|
|
18
|
+
["110100", 14],
|
|
19
|
+
["110101", 15],
|
|
20
|
+
["101010", 16],
|
|
21
|
+
["101011", 17],
|
|
22
|
+
["0100111", 18],
|
|
23
|
+
["0001100", 19],
|
|
24
|
+
["0001000", 20],
|
|
25
|
+
["0010111", 21],
|
|
26
|
+
["0000011", 22],
|
|
27
|
+
["0000100", 23],
|
|
28
|
+
["0101000", 24],
|
|
29
|
+
["0101011", 25],
|
|
30
|
+
["0010011", 26],
|
|
31
|
+
["0100100", 27],
|
|
32
|
+
["0011000", 28],
|
|
33
|
+
["00000010", 29],
|
|
34
|
+
["00000011", 30],
|
|
35
|
+
["00011010", 31],
|
|
36
|
+
["00011011", 32],
|
|
37
|
+
["00010010", 33],
|
|
38
|
+
["00010011", 34],
|
|
39
|
+
["00010100", 35],
|
|
40
|
+
["00010101", 36],
|
|
41
|
+
["00010110", 37],
|
|
42
|
+
["00010111", 38],
|
|
43
|
+
["00101000", 39],
|
|
44
|
+
["00101001", 40],
|
|
45
|
+
["00101010", 41],
|
|
46
|
+
["00101011", 42],
|
|
47
|
+
["00101100", 43],
|
|
48
|
+
["00101101", 44],
|
|
49
|
+
["00000100", 45],
|
|
50
|
+
["00000101", 46],
|
|
51
|
+
["00001010", 47],
|
|
52
|
+
["00001011", 48],
|
|
53
|
+
["01010010", 49],
|
|
54
|
+
["01010011", 50],
|
|
55
|
+
["01010100", 51],
|
|
56
|
+
["01010101", 52],
|
|
57
|
+
["00100100", 53],
|
|
58
|
+
["00100101", 54],
|
|
59
|
+
["01011000", 55],
|
|
60
|
+
["01011001", 56],
|
|
61
|
+
["01011010", 57],
|
|
62
|
+
["01011011", 58],
|
|
63
|
+
["01001010", 59],
|
|
64
|
+
["01001011", 60],
|
|
65
|
+
["00110010", 61],
|
|
66
|
+
["00110011", 62],
|
|
67
|
+
["00110100", 63],
|
|
68
|
+
["11011", 64],
|
|
69
|
+
["10010", 128],
|
|
70
|
+
["010111", 192],
|
|
71
|
+
["0110111", 256],
|
|
72
|
+
["00110110", 320],
|
|
73
|
+
["00110111", 384],
|
|
74
|
+
["01100100", 448],
|
|
75
|
+
["01100101", 512],
|
|
76
|
+
["01101000", 576],
|
|
77
|
+
["01100111", 640],
|
|
78
|
+
["011001100", 704],
|
|
79
|
+
["011001101", 768],
|
|
80
|
+
["011010010", 832],
|
|
81
|
+
["011010011", 896],
|
|
82
|
+
["011010100", 960],
|
|
83
|
+
["011010101", 1024],
|
|
84
|
+
["011010110", 1088],
|
|
85
|
+
["011010111", 1152],
|
|
86
|
+
["011011000", 1216],
|
|
87
|
+
["011011001", 1280],
|
|
88
|
+
["011011010", 1344],
|
|
89
|
+
["011011011", 1408],
|
|
90
|
+
["010011000", 1472],
|
|
91
|
+
["010011001", 1536],
|
|
92
|
+
["010011010", 1600],
|
|
93
|
+
["011000", 1664],
|
|
94
|
+
["010011011", 1728]
|
|
95
|
+
];
|
|
96
|
+
const BLACK_TERMINATING_AND_MAKEUP = [
|
|
97
|
+
["0000110111", 0],
|
|
98
|
+
["010", 1],
|
|
99
|
+
["11", 2],
|
|
100
|
+
["10", 3],
|
|
101
|
+
["011", 4],
|
|
102
|
+
["0011", 5],
|
|
103
|
+
["0010", 6],
|
|
104
|
+
["00011", 7],
|
|
105
|
+
["000101", 8],
|
|
106
|
+
["000100", 9],
|
|
107
|
+
["0000100", 10],
|
|
108
|
+
["0000101", 11],
|
|
109
|
+
["0000111", 12],
|
|
110
|
+
["00000100", 13],
|
|
111
|
+
["00000111", 14],
|
|
112
|
+
["000011000", 15],
|
|
113
|
+
["0000010111", 16],
|
|
114
|
+
["0000011000", 17],
|
|
115
|
+
["0000001000", 18],
|
|
116
|
+
["00001100111", 19],
|
|
117
|
+
["00001101000", 20],
|
|
118
|
+
["00001101100", 21],
|
|
119
|
+
["00000110111", 22],
|
|
120
|
+
["00000101000", 23],
|
|
121
|
+
["00000010111", 24],
|
|
122
|
+
["00000011000", 25],
|
|
123
|
+
["000011001010", 26],
|
|
124
|
+
["000011001011", 27],
|
|
125
|
+
["000011001100", 28],
|
|
126
|
+
["000011001101", 29],
|
|
127
|
+
["000001101000", 30],
|
|
128
|
+
["000001101001", 31],
|
|
129
|
+
["000001101010", 32],
|
|
130
|
+
["000001101011", 33],
|
|
131
|
+
["000011010010", 34],
|
|
132
|
+
["000011010011", 35],
|
|
133
|
+
["000011010100", 36],
|
|
134
|
+
["000011010101", 37],
|
|
135
|
+
["000011010110", 38],
|
|
136
|
+
["000011010111", 39],
|
|
137
|
+
["000001101100", 40],
|
|
138
|
+
["000001101101", 41],
|
|
139
|
+
["000011011010", 42],
|
|
140
|
+
["000011011011", 43],
|
|
141
|
+
["000001010100", 44],
|
|
142
|
+
["000001010101", 45],
|
|
143
|
+
["000001010110", 46],
|
|
144
|
+
["000001010111", 47],
|
|
145
|
+
["000001100100", 48],
|
|
146
|
+
["000001100101", 49],
|
|
147
|
+
["000001010010", 50],
|
|
148
|
+
["000001010011", 51],
|
|
149
|
+
["000000100100", 52],
|
|
150
|
+
["000000110111", 53],
|
|
151
|
+
["000000111000", 54],
|
|
152
|
+
["000000100111", 55],
|
|
153
|
+
["000000101000", 56],
|
|
154
|
+
["000001011000", 57],
|
|
155
|
+
["000001011001", 58],
|
|
156
|
+
["000000101011", 59],
|
|
157
|
+
["000000101100", 60],
|
|
158
|
+
["000001011010", 61],
|
|
159
|
+
["000001100110", 62],
|
|
160
|
+
["000001100111", 63],
|
|
161
|
+
["0000001111", 64],
|
|
162
|
+
["000011001000", 128],
|
|
163
|
+
["000011001001", 192],
|
|
164
|
+
["000001011011", 256],
|
|
165
|
+
["000000110011", 320],
|
|
166
|
+
["000000110100", 384],
|
|
167
|
+
["000000110101", 448],
|
|
168
|
+
["0000001101100", 512],
|
|
169
|
+
["0000001101101", 576],
|
|
170
|
+
["0000001001010", 640],
|
|
171
|
+
["0000001001011", 704],
|
|
172
|
+
["0000001001100", 768],
|
|
173
|
+
["0000001001101", 832],
|
|
174
|
+
["0000001110010", 896],
|
|
175
|
+
["0000001110011", 960],
|
|
176
|
+
["0000001110100", 1024],
|
|
177
|
+
["0000001110101", 1088],
|
|
178
|
+
["0000001110110", 1152],
|
|
179
|
+
["0000001110111", 1216],
|
|
180
|
+
["0000001010010", 1280],
|
|
181
|
+
["0000001010011", 1344],
|
|
182
|
+
["0000001010100", 1408],
|
|
183
|
+
["0000001010101", 1472],
|
|
184
|
+
["0000001011010", 1536],
|
|
185
|
+
["0000001011011", 1600],
|
|
186
|
+
["0000001100100", 1664],
|
|
187
|
+
["0000001100101", 1728]
|
|
188
|
+
];
|
|
189
|
+
const EXTENDED_MAKEUP = [
|
|
190
|
+
["00000001000", 1792],
|
|
191
|
+
["00000001100", 1856],
|
|
192
|
+
["00000001101", 1920],
|
|
193
|
+
["000000010010", 1984],
|
|
194
|
+
["000000010011", 2048],
|
|
195
|
+
["000000010100", 2112],
|
|
196
|
+
["000000010101", 2176],
|
|
197
|
+
["000000010110", 2240],
|
|
198
|
+
["000000010111", 2304],
|
|
199
|
+
["000000011100", 2368],
|
|
200
|
+
["000000011101", 2432],
|
|
201
|
+
["000000011110", 2496],
|
|
202
|
+
["000000011111", 2560]
|
|
203
|
+
];
|
|
204
|
+
const TERMINATING_RUN_LIMIT = 64;
|
|
205
|
+
const MAX_RUN_CODE_BITS = 14;
|
|
206
|
+
const MODE_CODES = [
|
|
207
|
+
["1", {
|
|
208
|
+
kind: "vertical",
|
|
209
|
+
delta: 0
|
|
210
|
+
}],
|
|
211
|
+
["011", {
|
|
212
|
+
kind: "vertical",
|
|
213
|
+
delta: 1
|
|
214
|
+
}],
|
|
215
|
+
["010", {
|
|
216
|
+
kind: "vertical",
|
|
217
|
+
delta: -1
|
|
218
|
+
}],
|
|
219
|
+
["001", {
|
|
220
|
+
kind: "horizontal",
|
|
221
|
+
delta: 0
|
|
222
|
+
}],
|
|
223
|
+
["0001", {
|
|
224
|
+
kind: "pass",
|
|
225
|
+
delta: 0
|
|
226
|
+
}],
|
|
227
|
+
["000011", {
|
|
228
|
+
kind: "vertical",
|
|
229
|
+
delta: 2
|
|
230
|
+
}],
|
|
231
|
+
["000010", {
|
|
232
|
+
kind: "vertical",
|
|
233
|
+
delta: -2
|
|
234
|
+
}],
|
|
235
|
+
["0000011", {
|
|
236
|
+
kind: "vertical",
|
|
237
|
+
delta: 3
|
|
238
|
+
}],
|
|
239
|
+
["0000010", {
|
|
240
|
+
kind: "vertical",
|
|
241
|
+
delta: -3
|
|
242
|
+
}],
|
|
243
|
+
["0000001", {
|
|
244
|
+
kind: "extension",
|
|
245
|
+
delta: 0
|
|
246
|
+
}]
|
|
247
|
+
];
|
|
248
|
+
const MAX_MODE_CODE_BITS = 7;
|
|
249
|
+
const EOL_MIN_ZEROS = 11;
|
|
250
|
+
const MAX_FILL_ZERO_BITS = 512;
|
|
251
|
+
function codeKey(bitLength, code) {
|
|
252
|
+
return bitLength * 2 ** 16 + code;
|
|
253
|
+
}
|
|
254
|
+
function buildCodeTable(...groups) {
|
|
255
|
+
const table = /* @__PURE__ */ new Map();
|
|
256
|
+
for (const group of groups) for (const [bits, run] of group) table.set(codeKey(bits.length, Number.parseInt(bits, 2)), run);
|
|
257
|
+
return table;
|
|
258
|
+
}
|
|
259
|
+
const WHITE_CODE_TABLE = buildCodeTable(WHITE_TERMINATING_AND_MAKEUP, EXTENDED_MAKEUP);
|
|
260
|
+
const BLACK_CODE_TABLE = buildCodeTable(BLACK_TERMINATING_AND_MAKEUP, EXTENDED_MAKEUP);
|
|
261
|
+
const MODE_CODE_TABLE = new Map(MODE_CODES.map(([bits, mode]) => [codeKey(bits.length, Number.parseInt(bits, 2)), mode]));
|
|
262
|
+
const BITS_PER_BYTE = 8;
|
|
263
|
+
var CcittBitReader = class {
|
|
264
|
+
data;
|
|
265
|
+
position = 0;
|
|
266
|
+
constructor(data) {
|
|
267
|
+
this.data = data;
|
|
268
|
+
}
|
|
269
|
+
get bitPosition() {
|
|
270
|
+
return this.position;
|
|
271
|
+
}
|
|
272
|
+
set bitPosition(value) {
|
|
273
|
+
this.position = value;
|
|
274
|
+
}
|
|
275
|
+
get exhausted() {
|
|
276
|
+
return this.position >= this.data.length * BITS_PER_BYTE;
|
|
277
|
+
}
|
|
278
|
+
readBit() {
|
|
279
|
+
if (this.exhausted) return -1;
|
|
280
|
+
const bit = (this.data[this.position >> 3] ?? 0) >> 7 - (this.position & 7) & 1;
|
|
281
|
+
this.position++;
|
|
282
|
+
return bit;
|
|
283
|
+
}
|
|
284
|
+
alignToByte() {
|
|
285
|
+
this.position = Math.ceil(this.position / BITS_PER_BYTE) * BITS_PER_BYTE;
|
|
286
|
+
}
|
|
287
|
+
get atZeroPadding() {
|
|
288
|
+
const remaining = this.data.length * BITS_PER_BYTE - this.position;
|
|
289
|
+
if (remaining <= 0) return true;
|
|
290
|
+
if (remaining >= BITS_PER_BYTE) return false;
|
|
291
|
+
return ((this.data[this.data.length - 1] ?? 0) & (1 << remaining) - 1) === 0;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
function readSingleRunCode(reader, table) {
|
|
295
|
+
let code = 0;
|
|
296
|
+
for (let bitLength = 1; bitLength <= MAX_RUN_CODE_BITS; bitLength++) {
|
|
297
|
+
const bit = reader.readBit();
|
|
298
|
+
if (bit < 0) return;
|
|
299
|
+
code = code << 1 | bit;
|
|
300
|
+
const run = table.get(codeKey(bitLength, code));
|
|
301
|
+
if (run !== void 0) return run;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function readRunLength(reader, black) {
|
|
305
|
+
const table = black ? BLACK_CODE_TABLE : WHITE_CODE_TABLE;
|
|
306
|
+
let total = 0;
|
|
307
|
+
for (;;) {
|
|
308
|
+
const run = readSingleRunCode(reader, table);
|
|
309
|
+
if (run === void 0) return;
|
|
310
|
+
total += run;
|
|
311
|
+
if (run < TERMINATING_RUN_LIMIT) return total;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function readModeCode(reader) {
|
|
315
|
+
let code = 0;
|
|
316
|
+
for (let bitLength = 1; bitLength <= MAX_MODE_CODE_BITS; bitLength++) {
|
|
317
|
+
const bit = reader.readBit();
|
|
318
|
+
if (bit < 0) return {
|
|
319
|
+
kind: "invalid",
|
|
320
|
+
delta: 0
|
|
321
|
+
};
|
|
322
|
+
code = code << 1 | bit;
|
|
323
|
+
const mode = MODE_CODE_TABLE.get(codeKey(bitLength, code));
|
|
324
|
+
if (mode !== void 0) return mode;
|
|
325
|
+
}
|
|
326
|
+
return code === 0 ? {
|
|
327
|
+
kind: "eol-prefix",
|
|
328
|
+
delta: 0
|
|
329
|
+
} : {
|
|
330
|
+
kind: "invalid",
|
|
331
|
+
delta: 0
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function tryReadEol(reader) {
|
|
335
|
+
const start = reader.bitPosition;
|
|
336
|
+
let zeros = 0;
|
|
337
|
+
for (;;) {
|
|
338
|
+
const bit = reader.readBit();
|
|
339
|
+
if (bit < 0) {
|
|
340
|
+
reader.bitPosition = start;
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
if (bit === 0) {
|
|
344
|
+
zeros++;
|
|
345
|
+
if (zeros > MAX_FILL_ZERO_BITS) {
|
|
346
|
+
reader.bitPosition = start;
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
if (zeros >= EOL_MIN_ZEROS) return true;
|
|
352
|
+
reader.bitPosition = start;
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
function findB1Index(reference, a0, color) {
|
|
357
|
+
let index = 0;
|
|
358
|
+
while (index < reference.length && reference[index] <= a0) index++;
|
|
359
|
+
if (index < reference.length && (index & 1) !== color) index++;
|
|
360
|
+
return index;
|
|
361
|
+
}
|
|
362
|
+
function elementAt(reference, index, columns) {
|
|
363
|
+
return index < reference.length ? reference[index] : columns;
|
|
364
|
+
}
|
|
365
|
+
function decode1dRow(reader, columns) {
|
|
366
|
+
const transitions = [];
|
|
367
|
+
let position = 0;
|
|
368
|
+
let black = false;
|
|
369
|
+
while (position < columns) {
|
|
370
|
+
const run = readRunLength(reader, black);
|
|
371
|
+
if (run === void 0) return;
|
|
372
|
+
position = Math.min(columns, position + run);
|
|
373
|
+
transitions.push(position);
|
|
374
|
+
black = !black;
|
|
375
|
+
}
|
|
376
|
+
return transitions;
|
|
377
|
+
}
|
|
378
|
+
function decode2dRow(reader, reference, columns) {
|
|
379
|
+
const transitions = [];
|
|
380
|
+
let a0 = -1;
|
|
381
|
+
let color = 0;
|
|
382
|
+
const maxTransitions = columns + 2;
|
|
383
|
+
while (a0 < columns) {
|
|
384
|
+
if (transitions.length > maxTransitions) return;
|
|
385
|
+
const mode = readModeCode(reader);
|
|
386
|
+
if (mode.kind === "invalid" || mode.kind === "extension") return;
|
|
387
|
+
if (mode.kind === "eol-prefix") return;
|
|
388
|
+
const b1Index = findB1Index(reference, a0, color);
|
|
389
|
+
const b1 = elementAt(reference, b1Index, columns);
|
|
390
|
+
const b2 = elementAt(reference, b1Index + 1, columns);
|
|
391
|
+
if (mode.kind === "pass") {
|
|
392
|
+
a0 = b2;
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
if (mode.kind === "horizontal") {
|
|
396
|
+
const start = a0 < 0 ? 0 : a0;
|
|
397
|
+
const firstRun = readRunLength(reader, color === 1);
|
|
398
|
+
if (firstRun === void 0) return;
|
|
399
|
+
const secondRun = readRunLength(reader, color !== 1);
|
|
400
|
+
if (secondRun === void 0) return;
|
|
401
|
+
const a1 = Math.min(columns, start + firstRun);
|
|
402
|
+
const a2 = Math.min(columns, a1 + secondRun);
|
|
403
|
+
transitions.push(a1, a2);
|
|
404
|
+
a0 = a2;
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
const a1 = Math.min(columns, Math.max(0, b1 + mode.delta));
|
|
408
|
+
transitions.push(a1);
|
|
409
|
+
a0 = a1;
|
|
410
|
+
color ^= 1;
|
|
411
|
+
}
|
|
412
|
+
return transitions;
|
|
413
|
+
}
|
|
414
|
+
function setBitRun(row, from, to, bit) {
|
|
415
|
+
for (let x = from; x < to; x++) {
|
|
416
|
+
const index = x >> 3;
|
|
417
|
+
const mask = 128 >> (x & 7);
|
|
418
|
+
if (bit === 1) row[index] = (row[index] ?? 0) | mask;
|
|
419
|
+
else row[index] = (row[index] ?? 0) & ~mask;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
function renderRow(transitions, columns, blackBit) {
|
|
423
|
+
const row = new Uint8Array(Math.ceil(columns / 8));
|
|
424
|
+
if (blackBit === 0) row.fill(255);
|
|
425
|
+
let position = 0;
|
|
426
|
+
let black = false;
|
|
427
|
+
for (const transition of transitions) {
|
|
428
|
+
const end = Math.min(transition, columns);
|
|
429
|
+
if (black && end > position) setBitRun(row, position, end, blackBit);
|
|
430
|
+
position = Math.max(position, end);
|
|
431
|
+
black = !black;
|
|
432
|
+
}
|
|
433
|
+
return row;
|
|
434
|
+
}
|
|
435
|
+
const DEFAULT_COLUMNS = 1728;
|
|
436
|
+
function decodeCcittFax(data, options = {}) {
|
|
437
|
+
const columns = options.columns ?? DEFAULT_COLUMNS;
|
|
438
|
+
const requestedRows = options.rows ?? 0;
|
|
439
|
+
const k = options.k ?? 0;
|
|
440
|
+
const blackBit = options.blackIs1 === true ? 1 : 0;
|
|
441
|
+
const encodedByteAlign = options.encodedByteAlign === true;
|
|
442
|
+
const warn = options.onWarning;
|
|
443
|
+
if (columns <= 0) return {
|
|
444
|
+
bytes: /* @__PURE__ */ new Uint8Array(0),
|
|
445
|
+
columns: 0,
|
|
446
|
+
rows: 0
|
|
447
|
+
};
|
|
448
|
+
const reader = new CcittBitReader(data);
|
|
449
|
+
const rows = [];
|
|
450
|
+
let reference = [];
|
|
451
|
+
let nextRowIs1d = k >= 0;
|
|
452
|
+
while (requestedRows === 0 || rows.length < requestedRows) {
|
|
453
|
+
if (encodedByteAlign) reader.alignToByte();
|
|
454
|
+
if (tryReadEol(reader)) {
|
|
455
|
+
if (k > 0) {
|
|
456
|
+
const tag = reader.readBit();
|
|
457
|
+
if (tag < 0) break;
|
|
458
|
+
nextRowIs1d = tag === 1;
|
|
459
|
+
}
|
|
460
|
+
if (tryReadEol(reader)) break;
|
|
461
|
+
}
|
|
462
|
+
if (reader.atZeroPadding) break;
|
|
463
|
+
const transitions = nextRowIs1d ? decode1dRow(reader, columns) : decode2dRow(reader, reference, columns);
|
|
464
|
+
if (transitions === void 0) {
|
|
465
|
+
if (warn !== void 0) warn(`CCITT fax data became undecodable at row ${String(rows.length)}; keeping the ${String(rows.length)} row(s) recovered so far`);
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
rows.push(renderRow(transitions, columns, blackBit));
|
|
469
|
+
reference = transitions;
|
|
470
|
+
}
|
|
471
|
+
if (requestedRows > 0 && rows.length < requestedRows) {
|
|
472
|
+
if (warn !== void 0 && rows.length > 0) warn(`CCITT fax data ended after ${String(rows.length)} of ${String(requestedRows)} declared rows; padding the remainder white`);
|
|
473
|
+
const bytesPerRow = Math.ceil(columns / 8);
|
|
474
|
+
while (rows.length < requestedRows) {
|
|
475
|
+
const blank = new Uint8Array(bytesPerRow);
|
|
476
|
+
if (blackBit === 0) blank.fill(255);
|
|
477
|
+
rows.push(blank);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return {
|
|
481
|
+
bytes: concatBytes(rows),
|
|
482
|
+
columns,
|
|
483
|
+
rows: rows.length
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
//#endregion
|
|
487
|
+
export { decodeCcittFax };
|
package/dist/images-read.cjs
CHANGED
|
@@ -170,11 +170,8 @@ function readSoftMaskAlpha(dict, width, height, resolver, sink) {
|
|
|
170
170
|
if (smaskWidth !== width || smaskHeight !== height || smaskBpc !== 8) return;
|
|
171
171
|
return decoded.bytes.subarray(0, width * height);
|
|
172
172
|
}
|
|
173
|
-
function isTrue(obj) {
|
|
174
|
-
return obj?.kind === "bool" && obj.value;
|
|
175
|
-
}
|
|
176
173
|
function readImageXObject(dict, raw, resolver, sink) {
|
|
177
|
-
if (
|
|
174
|
+
if (require_objects.asBool(require_objects.dictGet(dict, "ImageMask") ?? require_objects.dictGet(dict, "IM")) === true) {
|
|
178
175
|
sink({
|
|
179
176
|
code: "image/mask-unsupported",
|
|
180
177
|
severity: "info",
|
package/dist/images-read.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { asArray, asName, asNumber, dictGet } from "./objects.js";
|
|
1
|
+
import { asArray, asBool, asName, asNumber, dictGet } from "./objects.js";
|
|
2
2
|
import { decodeStream } from "./filters.js";
|
|
3
3
|
import { encodePng } from "./image/png-encode.js";
|
|
4
4
|
import { readJpegInfo } from "./image/jpeg-info.js";
|
|
@@ -169,11 +169,8 @@ function readSoftMaskAlpha(dict, width, height, resolver, sink) {
|
|
|
169
169
|
if (smaskWidth !== width || smaskHeight !== height || smaskBpc !== 8) return;
|
|
170
170
|
return decoded.bytes.subarray(0, width * height);
|
|
171
171
|
}
|
|
172
|
-
function isTrue(obj) {
|
|
173
|
-
return obj?.kind === "bool" && obj.value;
|
|
174
|
-
}
|
|
175
172
|
function readImageXObject(dict, raw, resolver, sink) {
|
|
176
|
-
if (
|
|
173
|
+
if (asBool(dictGet(dict, "ImageMask") ?? dictGet(dict, "IM")) === true) {
|
|
177
174
|
sink({
|
|
178
175
|
code: "image/mask-unsupported",
|
|
179
176
|
severity: "info",
|
package/dist/index.cjs
CHANGED
|
@@ -5,12 +5,14 @@ const require_bytes_crc32 = require("./bytes/crc32.cjs");
|
|
|
5
5
|
const require_bytes_writer = require("./bytes/writer.cjs");
|
|
6
6
|
const require_diagnostics = require("./diagnostics.cjs");
|
|
7
7
|
const require_bytes_flate = require("./bytes/flate.cjs");
|
|
8
|
+
const require_image_ccitt = require("./image/ccitt.cjs");
|
|
8
9
|
const require_image_png_filter = require("./image/png-filter.cjs");
|
|
9
10
|
const require_fonts = require("./fonts.cjs");
|
|
10
11
|
const require_image_png_encode = require("./image/png-encode.cjs");
|
|
11
12
|
const require_image_jpeg_info = require("./image/jpeg-info.cjs");
|
|
12
13
|
const require_matrix = require("./matrix.cjs");
|
|
13
14
|
const require_image_png_decode = require("./image/png-decode.cjs");
|
|
15
|
+
const require_font_registry = require("./font-registry.cjs");
|
|
14
16
|
const require_math_font = require("./math-font.cjs");
|
|
15
17
|
const require_measure = require("./measure.cjs");
|
|
16
18
|
const require_write = require("./write.cjs");
|
|
@@ -19,15 +21,20 @@ const require_codec = require("./codec.cjs");
|
|
|
19
21
|
const require_text_layout = require("./text-layout.cjs");
|
|
20
22
|
exports.ByteReader = require_bytes_reader.ByteReader;
|
|
21
23
|
exports.ByteWriter = require_bytes_writer.ByteWriter;
|
|
24
|
+
exports.DEFAULT_VERTICAL_METRIC_POLICY = require_measure.DEFAULT_VERTICAL_METRIC_POLICY;
|
|
22
25
|
exports.MAX_INFLATE_OUTPUT_BYTES = require_bytes_flate.MAX_INFLATE_OUTPUT_BYTES;
|
|
23
26
|
exports.NOOP_DIAGNOSTIC_SINK = require_diagnostics.NOOP_DIAGNOSTIC_SINK;
|
|
24
27
|
exports.PdfBytesSchema = require_codec.PdfBytesSchema;
|
|
25
28
|
exports.PdfEncryptedError = require_diagnostics.PdfEncryptedError;
|
|
26
29
|
exports.PdfParseError = require_diagnostics.PdfParseError;
|
|
30
|
+
exports.PdfPasswordRequiredError = require_diagnostics.PdfPasswordRequiredError;
|
|
27
31
|
exports.STANDARD_METRICS = require_afm_widths.STANDARD_METRICS;
|
|
28
32
|
exports.concatBytes = require_bytes_writer.concatBytes;
|
|
29
33
|
exports.crc32 = require_bytes_crc32.crc32;
|
|
34
|
+
exports.createFontMeasurer = require_measure.createFontMeasurer;
|
|
35
|
+
exports.createFontRegistry = require_font_registry.createFontRegistry;
|
|
30
36
|
exports.createStandardFontMeasurer = require_measure.createStandardFontMeasurer;
|
|
37
|
+
exports.decodeCcittFax = require_image_ccitt.decodeCcittFax;
|
|
31
38
|
exports.decodePng = require_image_png_decode.decodePng;
|
|
32
39
|
exports.deflate = require_bytes_flate.deflate;
|
|
33
40
|
exports.encodePng = require_image_png_encode.encodePng;
|
|
@@ -39,6 +46,7 @@ exports.loadMathFont = require_math_font.loadMathFont;
|
|
|
39
46
|
exports.pdfCodec = require_codec.pdfCodec;
|
|
40
47
|
exports.readJpegInfo = require_image_jpeg_info.readJpegInfo;
|
|
41
48
|
exports.readPdf = require_read.readPdf;
|
|
49
|
+
exports.resolveFaceWithRegistry = require_font_registry.resolveFaceWithRegistry;
|
|
42
50
|
exports.resolveStandardFont = require_fonts.resolveStandardFont;
|
|
43
51
|
exports.rotatePointAboutCenter = require_matrix.rotatePointAboutCenter;
|
|
44
52
|
exports.unfilterScanlines = require_image_png_filter.unfilterScanlines;
|
package/dist/index.d.cts
CHANGED
|
@@ -3,14 +3,17 @@ import { crc32 } from "./bytes/crc32.cjs";
|
|
|
3
3
|
import { DeflateLevel, InflateResult, MAX_INFLATE_OUTPUT_BYTES, deflate, inflate, inflateTolerant } from "./bytes/flate.cjs";
|
|
4
4
|
import { ByteReader, isAsciiWhitespace } from "./bytes/reader.cjs";
|
|
5
5
|
import { ByteWriter, concatBytes } from "./bytes/writer.cjs";
|
|
6
|
-
import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError } from "./diagnostics.cjs";
|
|
6
|
+
import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError } from "./diagnostics.cjs";
|
|
7
7
|
import { PdfBytesSchema, pdfCodec } from "./codec.cjs";
|
|
8
|
-
import {
|
|
8
|
+
import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-CLedn-mT.cjs";
|
|
9
|
+
import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-yby02snZ.cjs";
|
|
10
|
+
import { DEFAULT_VERTICAL_METRIC_POLICY, FontMeasurerOptions, StandardFontMeasurerOptions, TextMeasurer, UnderlineMetrics, VerticalMetricPolicy, createFontMeasurer, createStandardFontMeasurer } from "./measure.cjs";
|
|
9
11
|
import { WinAnsiSubstitution } from "./winansi.cjs";
|
|
10
|
-
import {
|
|
12
|
+
import { i as Point, u as rotatePointAboutCenter } from "./matrix-BHzJESll.cjs";
|
|
11
13
|
import { ResolvedFont, resolveStandardFont } from "./fonts.cjs";
|
|
12
14
|
import { a as MathGlyphRun, c as MathStroke, i as MathGlyphMetrics, n as MathColor, o as MathLayoutItem, r as MathFontMetrics, s as MathRule, t as MathBox } from "./math-types-Ba8qAf1p.cjs";
|
|
13
15
|
import { PositionedFormula } from "./formula.cjs";
|
|
16
|
+
import { CcittFaxImage, CcittFaxOptions, decodeCcittFax } from "./image/ccitt.cjs";
|
|
14
17
|
import { JpegInfo, readJpegInfo } from "./image/jpeg-info.cjs";
|
|
15
18
|
import { PngDecodeOptions, RawImage, decodePng } from "./image/png-decode.cjs";
|
|
16
19
|
import { PngEncodeOptions, encodePng } from "./image/png-encode.cjs";
|
|
@@ -19,4 +22,4 @@ import { ReadPdfOptions, readPdf } from "./read.cjs";
|
|
|
19
22
|
import { WritePdfOptions, writePdf } from "./write.cjs";
|
|
20
23
|
import { LoadedMathFont, MathFont, MathFontDescriptorMetrics, loadMathFont } from "./math-font.cjs";
|
|
21
24
|
import { StyledFragment, StyledRun, WrapOptions, WrappedLine, wrapRunsToWidth } from "./text-layout.cjs";
|
|
22
|
-
export { ByteReader, ByteWriter, type DeflateLevel, type FontMetrics, type InflateResult, type JpegInfo, type LoadedMathFont, MAX_INFLATE_OUTPUT_BYTES, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphMetrics, type MathGlyphRun, type MathLayoutItem, type MathRule, type MathStroke, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, type PngDecodeOptions, type PngEncodeOptions, type PngFilterType, type Point, type PositionedFormula, type RawImage, type ReadPdfOptions, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, concatBytes, crc32, createStandardFontMeasurer, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, pdfCodec, readJpegInfo, readPdf, resolveStandardFont, rotatePointAboutCenter, unfilterScanlines, wrapRunsToWidth, writePdf };
|
|
25
|
+
export { ByteReader, ByteWriter, type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type DeflateLevel, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, type FontMeasurerOptions, type FontMetrics, type FontRegistry, type FontRegistryOptions, type FontSubstitution, type InflateResult, type JpegInfo, type LoadedMathFont, MAX_INFLATE_OUTPUT_BYTES, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphMetrics, type MathGlyphRun, type MathLayoutItem, type MathRule, type MathStroke, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, type PngDecodeOptions, type PngEncodeOptions, type PngFilterType, type Point, type PositionedFormula, type ProvidedFont, type RawImage, type ReadPdfOptions, type ResolvedFace, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type VerticalMetricPolicy, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, concatBytes, crc32, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, pdfCodec, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, rotatePointAboutCenter, unfilterScanlines, wrapRunsToWidth, writePdf };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,17 @@ import { crc32 } from "./bytes/crc32.js";
|
|
|
3
3
|
import { DeflateLevel, InflateResult, MAX_INFLATE_OUTPUT_BYTES, deflate, inflate, inflateTolerant } from "./bytes/flate.js";
|
|
4
4
|
import { ByteReader, isAsciiWhitespace } from "./bytes/reader.js";
|
|
5
5
|
import { ByteWriter, concatBytes } from "./bytes/writer.js";
|
|
6
|
-
import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError } from "./diagnostics.js";
|
|
6
|
+
import { NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError } from "./diagnostics.js";
|
|
7
7
|
import { PdfBytesSchema, pdfCodec } from "./codec.js";
|
|
8
|
-
import {
|
|
8
|
+
import { n as EmbeddedFaceMetrics, r as EmbeddedFaceSubstitution, t as EmbeddedFace } from "./embedded-font-CbqkKgBl.js";
|
|
9
|
+
import { a as ResolvedFace, i as ProvidedFont, n as FontRegistryOptions, o as createFontRegistry, r as FontSubstitution, s as resolveFaceWithRegistry, t as FontRegistry } from "./font-registry-Cn7P9lAh.js";
|
|
10
|
+
import { DEFAULT_VERTICAL_METRIC_POLICY, FontMeasurerOptions, StandardFontMeasurerOptions, TextMeasurer, UnderlineMetrics, VerticalMetricPolicy, createFontMeasurer, createStandardFontMeasurer } from "./measure.js";
|
|
9
11
|
import { WinAnsiSubstitution } from "./winansi.js";
|
|
10
|
-
import {
|
|
12
|
+
import { i as Point, u as rotatePointAboutCenter } from "./matrix-BHzJESll.js";
|
|
11
13
|
import { ResolvedFont, resolveStandardFont } from "./fonts.js";
|
|
12
14
|
import { a as MathGlyphRun, c as MathStroke, i as MathGlyphMetrics, n as MathColor, o as MathLayoutItem, r as MathFontMetrics, s as MathRule, t as MathBox } from "./math-types-Ba8qAf1p.js";
|
|
13
15
|
import { PositionedFormula } from "./formula.js";
|
|
16
|
+
import { CcittFaxImage, CcittFaxOptions, decodeCcittFax } from "./image/ccitt.js";
|
|
14
17
|
import { JpegInfo, readJpegInfo } from "./image/jpeg-info.js";
|
|
15
18
|
import { PngDecodeOptions, RawImage, decodePng } from "./image/png-decode.js";
|
|
16
19
|
import { PngEncodeOptions, encodePng } from "./image/png-encode.js";
|
|
@@ -19,4 +22,4 @@ import { ReadPdfOptions, readPdf } from "./read.js";
|
|
|
19
22
|
import { WritePdfOptions, writePdf } from "./write.js";
|
|
20
23
|
import { LoadedMathFont, MathFont, MathFontDescriptorMetrics, loadMathFont } from "./math-font.js";
|
|
21
24
|
import { StyledFragment, StyledRun, WrapOptions, WrappedLine, wrapRunsToWidth } from "./text-layout.js";
|
|
22
|
-
export { ByteReader, ByteWriter, type DeflateLevel, type FontMetrics, type InflateResult, type JpegInfo, type LoadedMathFont, MAX_INFLATE_OUTPUT_BYTES, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphMetrics, type MathGlyphRun, type MathLayoutItem, type MathRule, type MathStroke, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, type PngDecodeOptions, type PngEncodeOptions, type PngFilterType, type Point, type PositionedFormula, type RawImage, type ReadPdfOptions, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, concatBytes, crc32, createStandardFontMeasurer, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, pdfCodec, readJpegInfo, readPdf, resolveStandardFont, rotatePointAboutCenter, unfilterScanlines, wrapRunsToWidth, writePdf };
|
|
25
|
+
export { ByteReader, ByteWriter, type CcittFaxImage, type CcittFaxOptions, DEFAULT_VERTICAL_METRIC_POLICY, type DeflateLevel, type EmbeddedFace, type EmbeddedFaceMetrics, type EmbeddedFaceSubstitution, type FontMeasurerOptions, type FontMetrics, type FontRegistry, type FontRegistryOptions, type FontSubstitution, type InflateResult, type JpegInfo, type LoadedMathFont, MAX_INFLATE_OUTPUT_BYTES, type MathBox, type MathColor, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphMetrics, type MathGlyphRun, type MathLayoutItem, type MathRule, type MathStroke, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, type PngDecodeOptions, type PngEncodeOptions, type PngFilterType, type Point, type PositionedFormula, type ProvidedFont, type RawImage, type ReadPdfOptions, type ResolvedFace, type ResolvedFont, STANDARD_METRICS, type StandardFontMeasurerOptions, type StandardFontName, type StyledFragment, type StyledRun, type TextMeasurer, type UnderlineMetrics, type VerticalMetricPolicy, type WinAnsiSubstitution, type WrapOptions, type WrappedLine, type WritePdfOptions, concatBytes, crc32, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, pdfCodec, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, rotatePointAboutCenter, unfilterScanlines, wrapRunsToWidth, writePdf };
|
package/dist/index.js
CHANGED
|
@@ -2,18 +2,20 @@ import { t as STANDARD_METRICS } from "./afm-widths-Dxucrg7D.js";
|
|
|
2
2
|
import { ByteReader, isAsciiWhitespace } from "./bytes/reader.js";
|
|
3
3
|
import { crc32 } from "./bytes/crc32.js";
|
|
4
4
|
import { ByteWriter, concatBytes } from "./bytes/writer.js";
|
|
5
|
-
import { NOOP_DIAGNOSTIC_SINK, PdfEncryptedError, PdfParseError } from "./diagnostics.js";
|
|
5
|
+
import { NOOP_DIAGNOSTIC_SINK, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError } from "./diagnostics.js";
|
|
6
6
|
import { MAX_INFLATE_OUTPUT_BYTES, deflate, inflate, inflateTolerant } from "./bytes/flate.js";
|
|
7
|
+
import { decodeCcittFax } from "./image/ccitt.js";
|
|
7
8
|
import { filterScanlines, unfilterScanlines } from "./image/png-filter.js";
|
|
8
9
|
import { resolveStandardFont } from "./fonts.js";
|
|
9
10
|
import { encodePng } from "./image/png-encode.js";
|
|
10
11
|
import { readJpegInfo } from "./image/jpeg-info.js";
|
|
11
12
|
import { rotatePointAboutCenter } from "./matrix.js";
|
|
12
13
|
import { decodePng } from "./image/png-decode.js";
|
|
14
|
+
import { createFontRegistry, resolveFaceWithRegistry } from "./font-registry.js";
|
|
13
15
|
import { loadMathFont } from "./math-font.js";
|
|
14
|
-
import { createStandardFontMeasurer } from "./measure.js";
|
|
16
|
+
import { DEFAULT_VERTICAL_METRIC_POLICY, createFontMeasurer, createStandardFontMeasurer } from "./measure.js";
|
|
15
17
|
import { writePdf } from "./write.js";
|
|
16
18
|
import { readPdf } from "./read.js";
|
|
17
19
|
import { PdfBytesSchema, pdfCodec } from "./codec.js";
|
|
18
20
|
import { wrapRunsToWidth } from "./text-layout.js";
|
|
19
|
-
export { ByteReader, ByteWriter, MAX_INFLATE_OUTPUT_BYTES, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, PdfEncryptedError, PdfParseError, STANDARD_METRICS, concatBytes, crc32, createStandardFontMeasurer, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, pdfCodec, readJpegInfo, readPdf, resolveStandardFont, rotatePointAboutCenter, unfilterScanlines, wrapRunsToWidth, writePdf };
|
|
21
|
+
export { ByteReader, ByteWriter, DEFAULT_VERTICAL_METRIC_POLICY, MAX_INFLATE_OUTPUT_BYTES, NOOP_DIAGNOSTIC_SINK, PdfBytesSchema, PdfEncryptedError, PdfParseError, PdfPasswordRequiredError, STANDARD_METRICS, concatBytes, crc32, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, decodeCcittFax, decodePng, deflate, encodePng, filterScanlines, inflate, inflateTolerant, isAsciiWhitespace, loadMathFont, pdfCodec, readJpegInfo, readPdf, resolveFaceWithRegistry, resolveStandardFont, rotatePointAboutCenter, unfilterScanlines, wrapRunsToWidth, writePdf };
|