@sythos/js_barcode_universal 1.5.5 → 1.5.7
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 +15 -3
- package/bundle/sythos-barcode.esm.js +2 -2
- package/bundle/sythos-barcode.js +2 -2
- package/examples/read.html +5 -3
- package/package.json +91 -25
- package/src/index.js +1 -1
- package/typings/aztec/decoder.d.ts +57 -0
- package/typings/aztec/detector.d.ts +62 -0
- package/typings/aztec/encoder.d.ts +94 -0
- package/typings/aztec/high-level.d.ts +89 -0
- package/typings/aztec/index.d.ts +35 -0
- package/typings/aztec/tables.d.ts +144 -0
- package/typings/aztecrune/decoder.d.ts +56 -0
- package/typings/aztecrune/detector.d.ts +53 -0
- package/typings/aztecrune/encoder.d.ts +51 -0
- package/typings/aztecrune/index.d.ts +35 -0
- package/typings/aztecrune/tables.d.ts +75 -0
- package/typings/bundle/sythos-barcode.d.ts +31 -0
- package/typings/bundle/sythos-barcode.esm.d.ts +31 -0
- package/typings/compactpdf417/decoder.d.ts +64 -0
- package/typings/compactpdf417/detector.d.ts +48 -0
- package/typings/compactpdf417/encoder.d.ts +49 -0
- package/typings/compactpdf417/index.d.ts +8 -0
- package/typings/compactpdf417/tables.d.ts +84 -0
- package/typings/core/bit-buffer.d.ts +78 -0
- package/typings/core/bit-matrix.d.ts +129 -0
- package/typings/core/errors.d.ts +57 -0
- package/typings/core/galois-field.d.ts +141 -0
- package/typings/core/index.d.ts +40 -0
- package/typings/core/reed-solomon.d.ts +65 -0
- package/typings/databar/codec.d.ts +78 -0
- package/typings/databar/decoder.d.ts +55 -0
- package/typings/databar/encoder.d.ts +34 -0
- package/typings/databar/gs1.d.ts +48 -0
- package/typings/databar/index.d.ts +37 -0
- package/typings/databar/patterns.d.ts +46 -0
- package/typings/databar/tables.d.ts +119 -0
- package/typings/datamatrix/decoder.d.ts +57 -0
- package/typings/datamatrix/detector.d.ts +59 -0
- package/typings/datamatrix/encoder.d.ts +36 -0
- package/typings/datamatrix/index.d.ts +35 -0
- package/typings/datamatrix/tables.d.ts +88 -0
- package/typings/frameqr/decoder.d.ts +64 -0
- package/typings/frameqr/detector.d.ts +96 -0
- package/typings/frameqr/encoder.d.ts +73 -0
- package/typings/frameqr/index.d.ts +34 -0
- package/typings/frameqr/tables.d.ts +123 -0
- package/typings/image/binarizer.d.ts +85 -0
- package/typings/image/grid-sampler.d.ts +82 -0
- package/typings/image/index.d.ts +39 -0
- package/typings/image/luminance.d.ts +112 -0
- package/typings/image/perspective.d.ts +111 -0
- package/typings/index.d.ts +363 -0
- package/typings/micropdf417/compaction.d.ts +38 -0
- package/typings/micropdf417/decoder.d.ts +57 -0
- package/typings/micropdf417/detector.d.ts +95 -0
- package/typings/micropdf417/encoder.d.ts +34 -0
- package/typings/micropdf417/error-correction.d.ts +38 -0
- package/typings/micropdf417/index.d.ts +36 -0
- package/typings/micropdf417/tables.d.ts +73 -0
- package/typings/microqr/decoder.d.ts +49 -0
- package/typings/microqr/detector.d.ts +96 -0
- package/typings/microqr/encoder.d.ts +33 -0
- package/typings/microqr/index.d.ts +35 -0
- package/typings/microqr/tables.d.ts +107 -0
- package/typings/oned/addons.d.ts +181 -0
- package/typings/oned/index.d.ts +55 -0
- package/typings/oned/patterns.d.ts +259 -0
- package/typings/oned/reader.d.ts +129 -0
- package/typings/oned/writers.d.ts +218 -0
- package/typings/pdf417/compaction.d.ts +59 -0
- package/typings/pdf417/decoder.d.ts +48 -0
- package/typings/pdf417/detector.d.ts +73 -0
- package/typings/pdf417/encoder.d.ts +32 -0
- package/typings/pdf417/error-correction.d.ts +34 -0
- package/typings/pdf417/index.d.ts +10 -0
- package/typings/pdf417/tables.d.ts +53 -0
- package/typings/qr/decoder.d.ts +79 -0
- package/typings/qr/detector.d.ts +93 -0
- package/typings/qr/encoder.d.ts +166 -0
- package/typings/qr/index.d.ts +43 -0
- package/typings/qr/tables.d.ts +291 -0
- package/typings/render/image-data.d.ts +58 -0
- package/typings/render/index.d.ts +110 -0
- package/typings/render/options.d.ts +98 -0
- package/typings/render/png.d.ts +58 -0
- package/typings/render/svg.d.ts +46 -0
- package/typings/render/webgl.d.ts +45 -0
- package/typings/render/webgpu.d.ts +51 -0
- package/typings/rmqr/decoder.d.ts +42 -0
- package/typings/rmqr/detector.d.ts +81 -0
- package/typings/rmqr/encoder.d.ts +45 -0
- package/typings/rmqr/index.d.ts +34 -0
- package/typings/rmqr/tables.d.ts +89 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Linear barcode writers.
|
|
33
|
+
*
|
|
34
|
+
* Every writer returns a `BitMatrix` one module tall. Height is a rendering
|
|
35
|
+
* decision, not an encoding one — a linear symbol carries no information
|
|
36
|
+
* vertically, which is exactly why it survives a laser line that crosses it
|
|
37
|
+
* anywhere. The renderers stretch it via the `barHeight` option.
|
|
38
|
+
*
|
|
39
|
+
* @module oned/writers
|
|
40
|
+
*/
|
|
41
|
+
import { BitMatrix } from '../core/bit-matrix.js';
|
|
42
|
+
/**
|
|
43
|
+
* Modulo-10 check digit for the EAN/UPC family.
|
|
44
|
+
*
|
|
45
|
+
* Weights alternate 3 and 1, with the digit immediately left of the check
|
|
46
|
+
* position weighted 3. Anchoring from the right rather than the left makes one
|
|
47
|
+
* routine correct for EAN-8, EAN-13 and UPC-A alike, despite their different
|
|
48
|
+
* payload lengths.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} payload Digits, excluding the check digit.
|
|
51
|
+
* @returns {number}
|
|
52
|
+
*/
|
|
53
|
+
export declare function ean13CheckDigit(payload: string): number;
|
|
54
|
+
/**
|
|
55
|
+
* EAN-13. Accepts 12 digits (check digit appended) or 13 (verified).
|
|
56
|
+
*
|
|
57
|
+
* @param {string} value
|
|
58
|
+
* @returns {BitMatrix}
|
|
59
|
+
*/
|
|
60
|
+
export declare function encodeEAN13(value: string): BitMatrix;
|
|
61
|
+
/**
|
|
62
|
+
* EAN-8. Accepts 7 digits (check digit appended) or 8 (verified).
|
|
63
|
+
*
|
|
64
|
+
* @param {string} value
|
|
65
|
+
* @returns {BitMatrix}
|
|
66
|
+
*/
|
|
67
|
+
export declare function encodeEAN8(value: string): BitMatrix;
|
|
68
|
+
/**
|
|
69
|
+
* ISBN, as its printed EAN-13 ("Bookland") symbol.
|
|
70
|
+
*
|
|
71
|
+
* ISBN is not a separate symbology — an ISBN barcode *is* an EAN-13 carrying a
|
|
72
|
+
* 978 or 979 prefix. What ISBN adds is its own numbering rules, and those are
|
|
73
|
+
* worth enforcing here: an ISBN-10 uses a modulo-**11** check digit, in which
|
|
74
|
+
* the value ten is written `X`. That is a different calculation from the
|
|
75
|
+
* modulo-10 check the EAN symbol will carry. Passing an ISBN-10 straight
|
|
76
|
+
* through would produce a perfectly scannable symbol encoding the wrong
|
|
77
|
+
* number, so the two checks are kept distinct and the digit is recomputed.
|
|
78
|
+
*
|
|
79
|
+
* Accepts ISBN-10 or ISBN-13, with or without hyphens and spaces.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} value
|
|
82
|
+
* @returns {BitMatrix}
|
|
83
|
+
*/
|
|
84
|
+
export declare function encodeISBN(value: string): BitMatrix;
|
|
85
|
+
/**
|
|
86
|
+
* UPC-A. Structurally an EAN-13 whose first digit is zero.
|
|
87
|
+
*
|
|
88
|
+
* @param {string} value 11 or 12 digits.
|
|
89
|
+
* @returns {BitMatrix}
|
|
90
|
+
*/
|
|
91
|
+
export declare function encodeUPCA(value: string): BitMatrix;
|
|
92
|
+
/**
|
|
93
|
+
* Expand a UPC-E body to the 11 digits preceding the check digit.
|
|
94
|
+
*
|
|
95
|
+
* @param {number} system Number system, 0 or 1.
|
|
96
|
+
* @param {string} body 6 digits.
|
|
97
|
+
* @returns {string} 11 digits.
|
|
98
|
+
*/
|
|
99
|
+
export declare function upceToUpcaBody(system: number, body: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* UPC-E, the zero-suppressed form of UPC-A.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} value 6 digits (system 0 assumed), 7 (system + body), or 8 (with check).
|
|
104
|
+
* @returns {BitMatrix}
|
|
105
|
+
*/
|
|
106
|
+
export declare function encodeUPCE(value: string): BitMatrix;
|
|
107
|
+
/**
|
|
108
|
+
* Code 39.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} value
|
|
111
|
+
* @param {object} [options]
|
|
112
|
+
* @param {boolean} [options.checkDigit] Append the modulo-43 check character.
|
|
113
|
+
* @param {boolean} [options.fullAscii] Escape characters outside the native set.
|
|
114
|
+
* @param {number} [options.wideRatio] Wide-to-narrow ratio, 2 or 3.
|
|
115
|
+
* @returns {BitMatrix}
|
|
116
|
+
*/
|
|
117
|
+
export declare function encodeCode39(value: string, options?: {
|
|
118
|
+
checkDigit?: boolean;
|
|
119
|
+
fullAscii?: boolean;
|
|
120
|
+
wideRatio?: number;
|
|
121
|
+
}): BitMatrix;
|
|
122
|
+
/**
|
|
123
|
+
* Code 93, always with its two mandatory check characters.
|
|
124
|
+
*
|
|
125
|
+
* @param {string} value
|
|
126
|
+
* @returns {BitMatrix}
|
|
127
|
+
*/
|
|
128
|
+
export declare function encodeCode93(value: string): BitMatrix;
|
|
129
|
+
/**
|
|
130
|
+
* Code 128, with automatic code-set selection.
|
|
131
|
+
*
|
|
132
|
+
* The heuristic: switch into set C when enough consecutive digits are present
|
|
133
|
+
* to repay the switch symbol — four at the start or end of the payload, six in
|
|
134
|
+
* the middle, since C packs two digits per symbol. An encoder that never
|
|
135
|
+
* switches produces a valid but needlessly wide symbol.
|
|
136
|
+
*
|
|
137
|
+
* @param {string} value
|
|
138
|
+
* @param {object} [options]
|
|
139
|
+
* @param {boolean} [options.gs1] Emit a leading FNC1, making this GS1-128.
|
|
140
|
+
* @returns {BitMatrix}
|
|
141
|
+
*/
|
|
142
|
+
export declare function encodeCode128(value: string, options?: {
|
|
143
|
+
gs1?: boolean;
|
|
144
|
+
}): BitMatrix;
|
|
145
|
+
/**
|
|
146
|
+
* Interleaved 2 of 5.
|
|
147
|
+
*
|
|
148
|
+
* Digits are encoded in pairs: the first supplies the bars, the second the
|
|
149
|
+
* spaces between them. That interleaving is where the density comes from, and
|
|
150
|
+
* why the payload length must be even.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} value
|
|
153
|
+
* @param {object} [options]
|
|
154
|
+
* @param {boolean} [options.checkDigit] Append a modulo-10 check digit.
|
|
155
|
+
* @param {number} [options.wideRatio]
|
|
156
|
+
* @returns {BitMatrix}
|
|
157
|
+
*/
|
|
158
|
+
export declare function encodeITF(value: string, options?: {
|
|
159
|
+
checkDigit?: boolean;
|
|
160
|
+
wideRatio?: number;
|
|
161
|
+
}): BitMatrix;
|
|
162
|
+
/**
|
|
163
|
+
* ITF-14, the shipping-container form: exactly 14 digits.
|
|
164
|
+
*
|
|
165
|
+
* @param {string} value 13 or 14 digits.
|
|
166
|
+
* @returns {BitMatrix}
|
|
167
|
+
*/
|
|
168
|
+
export declare function encodeITF14(value: string): BitMatrix;
|
|
169
|
+
/**
|
|
170
|
+
* Codabar.
|
|
171
|
+
*
|
|
172
|
+
* @param {string} value Optionally already wrapped in start/stop characters A-D.
|
|
173
|
+
* @param {object} [options]
|
|
174
|
+
* @param {string} [options.start] One of A, B, C, D.
|
|
175
|
+
* @param {string} [options.stop]
|
|
176
|
+
* @param {number} [options.wideRatio]
|
|
177
|
+
* @returns {BitMatrix}
|
|
178
|
+
*/
|
|
179
|
+
export declare function encodeCodabar(value: string, options?: {
|
|
180
|
+
start?: string;
|
|
181
|
+
stop?: string;
|
|
182
|
+
wideRatio?: number;
|
|
183
|
+
}): BitMatrix;
|
|
184
|
+
/**
|
|
185
|
+
* Code 11, digits and hyphen.
|
|
186
|
+
*
|
|
187
|
+
* @param {string} value
|
|
188
|
+
* @param {object} [options]
|
|
189
|
+
* @param {boolean} [options.checkDigit] Append check character C, plus K when long.
|
|
190
|
+
* @param {number} [options.wideRatio]
|
|
191
|
+
* @returns {BitMatrix}
|
|
192
|
+
*/
|
|
193
|
+
export declare function encodeCode11(value: string, options?: {
|
|
194
|
+
checkDigit?: boolean;
|
|
195
|
+
wideRatio?: number;
|
|
196
|
+
}): BitMatrix;
|
|
197
|
+
/**
|
|
198
|
+
* MSI Plessey.
|
|
199
|
+
*
|
|
200
|
+
* @param {string} value Digits.
|
|
201
|
+
* @param {object} [options]
|
|
202
|
+
* @param {boolean} [options.checkDigit] Append the Luhn modulo-10 check digit.
|
|
203
|
+
* @returns {BitMatrix}
|
|
204
|
+
*/
|
|
205
|
+
export declare function encodeMSI(value: string, options?: {
|
|
206
|
+
checkDigit?: boolean;
|
|
207
|
+
}): BitMatrix;
|
|
208
|
+
/**
|
|
209
|
+
* Pharmacode, one-track.
|
|
210
|
+
*
|
|
211
|
+
* Unusual among linear symbologies: it encodes an integer directly in a
|
|
212
|
+
* bijective base-2 representation rather than digit by digit, and carries no
|
|
213
|
+
* check digit at all — its only redundancy is the narrow legal value range.
|
|
214
|
+
*
|
|
215
|
+
* @param {number | string} value 3 to 131070.
|
|
216
|
+
* @returns {BitMatrix}
|
|
217
|
+
*/
|
|
218
|
+
export declare function encodePharmacode(value: number | string): BitMatrix;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
/** Compact a value using the PDF417 Text Compaction alphabet. */
|
|
32
|
+
export declare function compactPdf417Text(value: any): any[];
|
|
33
|
+
/** Compact bytes using latch 924 for exact six-byte blocks and 901 otherwise. */
|
|
34
|
+
export declare function compactPdf417Bytes(value: any): number[];
|
|
35
|
+
/** Compact decimal digits using latch 902 and groups of at most 44 digits. */
|
|
36
|
+
export declare function compactPdf417Numeric(value: any): number[];
|
|
37
|
+
/** Compact a single value, selecting text, numeric or byte mode. */
|
|
38
|
+
export declare function compactPdf417(value: any, options?: {}): any[];
|
|
39
|
+
/**
|
|
40
|
+
* Decode PDF417 compaction while preserving raw Byte Compaction and byte-shift
|
|
41
|
+
* payloads. Text and Numeric Compaction do not manufacture bytes: their text
|
|
42
|
+
* is available on each segment, while `bytes` contains only octets carried by
|
|
43
|
+
* modes that encode octets explicitly.
|
|
44
|
+
*/
|
|
45
|
+
export declare function decodePdf417CompactionDetailed(codewords: any): {
|
|
46
|
+
text: string;
|
|
47
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
48
|
+
segments: {
|
|
49
|
+
mode: string;
|
|
50
|
+
text: string;
|
|
51
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
52
|
+
eci: number;
|
|
53
|
+
latch: any;
|
|
54
|
+
codewordStart: number;
|
|
55
|
+
codewordEnd: number;
|
|
56
|
+
}[];
|
|
57
|
+
};
|
|
58
|
+
/** Decode PDF417 Text, Byte, Numeric and UTF-8 ECI compaction segments in source order. */
|
|
59
|
+
export declare function decodePdf417Compaction(codewords: any): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
export declare function decodePDF417(matrix: any, options?: {}): {
|
|
32
|
+
text: string;
|
|
33
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
34
|
+
segments: {
|
|
35
|
+
mode: string;
|
|
36
|
+
text: string;
|
|
37
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
38
|
+
eci: number;
|
|
39
|
+
latch: any;
|
|
40
|
+
codewordStart: number;
|
|
41
|
+
codewordEnd: number;
|
|
42
|
+
}[];
|
|
43
|
+
codewords: number[];
|
|
44
|
+
rows: number;
|
|
45
|
+
columns: number;
|
|
46
|
+
eccLevel: number;
|
|
47
|
+
corrections: number;
|
|
48
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
import { BitMatrix } from '../core/bit-matrix.js';
|
|
32
|
+
export declare function detectPDF417(binaryImage: any, options?: {}): {
|
|
33
|
+
text: string;
|
|
34
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
35
|
+
segments: {
|
|
36
|
+
mode: string;
|
|
37
|
+
text: string;
|
|
38
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
39
|
+
eci: number;
|
|
40
|
+
latch: any;
|
|
41
|
+
codewordStart: number;
|
|
42
|
+
codewordEnd: number;
|
|
43
|
+
}[];
|
|
44
|
+
codewords: number[];
|
|
45
|
+
rows: number;
|
|
46
|
+
columns: number;
|
|
47
|
+
eccLevel: number;
|
|
48
|
+
corrections: number;
|
|
49
|
+
matrix: BitMatrix;
|
|
50
|
+
rotation: number;
|
|
51
|
+
corners: any;
|
|
52
|
+
} | null;
|
|
53
|
+
export declare function detectAndDecodePDF417(binaryImage: any, options?: {}): {
|
|
54
|
+
text: string;
|
|
55
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
56
|
+
segments: {
|
|
57
|
+
mode: string;
|
|
58
|
+
text: string;
|
|
59
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
60
|
+
eci: number;
|
|
61
|
+
latch: any;
|
|
62
|
+
codewordStart: number;
|
|
63
|
+
codewordEnd: number;
|
|
64
|
+
}[];
|
|
65
|
+
codewords: number[];
|
|
66
|
+
rows: number;
|
|
67
|
+
columns: number;
|
|
68
|
+
eccLevel: number;
|
|
69
|
+
corrections: number;
|
|
70
|
+
matrix: BitMatrix;
|
|
71
|
+
rotation: number;
|
|
72
|
+
corners: any;
|
|
73
|
+
} | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
import { BitMatrix } from '../core/bit-matrix.js';
|
|
32
|
+
export declare function encodePDF417(value: any, options?: {}): BitMatrix;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
export declare function pdf417EccLength(level: any): number;
|
|
32
|
+
export declare function pdf417ErrorCorrection(data: any, level: any): number[];
|
|
33
|
+
/** Correct PDF417 codewords, optionally marking unreadable codewords as erasures. */
|
|
34
|
+
export declare function pdf417CorrectErrors(codewords: any, level: any, erasures?: any[]): number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
export { compactPdf417, compactPdf417Text, compactPdf417Bytes, compactPdf417Numeric, decodePdf417Compaction, decodePdf417CompactionDetailed } from './compaction.js';
|
|
6
|
+
export { encodePDF417 } from './encoder.js';
|
|
7
|
+
export { decodePDF417 } from './decoder.js';
|
|
8
|
+
export { detectPDF417, detectAndDecodePDF417 } from './detector.js';
|
|
9
|
+
export { pdf417EccLength, pdf417ErrorCorrection, pdf417CorrectErrors } from './error-correction.js';
|
|
10
|
+
export { PDF417_PATTERN_TABLE, PDF417_CLUSTER_NUMBERS, pdf417PatternForCodeword, pdf417CodewordForPattern } from './tables.js';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
/** PDF417 symbol-character pattern table. @module pdf417/tables */
|
|
32
|
+
export declare const PDF417_CLUSTER_NUMBERS: readonly number[];
|
|
33
|
+
export declare const PDF417_CODEWORDS_PER_CLUSTER = 929;
|
|
34
|
+
/** Return the cluster discriminator for an eight-element bar/space sequence. */
|
|
35
|
+
export declare function pdf417ClusterForWidths(widths: any): number;
|
|
36
|
+
/** Pattern table indexed by cluster index (0, 1, 2) and codeword value. */
|
|
37
|
+
export declare const PDF417_PATTERN_TABLE: readonly (readonly number[])[];
|
|
38
|
+
/**
|
|
39
|
+
* Return the 17-bit bar/space pattern for a codeword in a row cluster.
|
|
40
|
+
* @param {number} codeword
|
|
41
|
+
* @param {number} cluster Cluster number 0, 3 or 6.
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
44
|
+
export declare function pdf417PatternForCodeword(codeword: number, cluster: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* Decode an exact 17-bit symbol-character pattern to its codeword and cluster.
|
|
47
|
+
* @param {number} pattern
|
|
48
|
+
* @returns {{codeword: number, cluster: number} | null}
|
|
49
|
+
*/
|
|
50
|
+
export declare function pdf417CodewordForPattern(pattern: number): {
|
|
51
|
+
codeword: number;
|
|
52
|
+
cluster: number;
|
|
53
|
+
} | null;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
import { ChecksumError } from '../core/errors.js';
|
|
32
|
+
export type DecodeResult = {
|
|
33
|
+
/**
|
|
34
|
+
* Decoded payload.
|
|
35
|
+
*/
|
|
36
|
+
text: string;
|
|
37
|
+
/**
|
|
38
|
+
* Raw bytes of the byte-mode segments; empty when
|
|
39
|
+
* the payload used no byte segments.
|
|
40
|
+
*/
|
|
41
|
+
bytes: Uint8Array;
|
|
42
|
+
/**
|
|
43
|
+
* 1-40.
|
|
44
|
+
*/
|
|
45
|
+
version: number;
|
|
46
|
+
/**
|
|
47
|
+
* 'L' | 'M' | 'Q' | 'H'.
|
|
48
|
+
*/
|
|
49
|
+
ecc: string;
|
|
50
|
+
/**
|
|
51
|
+
* 0-7.
|
|
52
|
+
*/
|
|
53
|
+
mask: number;
|
|
54
|
+
/**
|
|
55
|
+
* Symbols repaired by Reed-Solomon.
|
|
56
|
+
*/
|
|
57
|
+
corrections: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* @typedef {object} DecodeResult
|
|
61
|
+
* @property {string} text Decoded payload.
|
|
62
|
+
* @property {Uint8Array} bytes Raw bytes of the byte-mode segments; empty when
|
|
63
|
+
* the payload used no byte segments.
|
|
64
|
+
* @property {number} version 1-40.
|
|
65
|
+
* @property {string} ecc 'L' | 'M' | 'Q' | 'H'.
|
|
66
|
+
* @property {number} mask 0-7.
|
|
67
|
+
* @property {number} corrections Symbols repaired by Reed-Solomon.
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* Decode a sampled QR Code symbol.
|
|
71
|
+
*
|
|
72
|
+
* @param {import('../core/bit-matrix.js').BitMatrix} matrix Square, exactly the
|
|
73
|
+
* symbol, no quiet zone. Set bit = dark module.
|
|
74
|
+
* @returns {DecodeResult}
|
|
75
|
+
* @throws {FormatError} If the geometry or content is malformed.
|
|
76
|
+
* @throws {ChecksumError} If error correction cannot repair the symbol.
|
|
77
|
+
*/
|
|
78
|
+
export declare function decodeQR(matrix: import('../core/bit-matrix.js').BitMatrix): DecodeResult;
|
|
79
|
+
export { ChecksumError };
|