0
# Industrial and Specialized Formats
1
2
JsBarcode supports several specialized barcode formats commonly used in industrial applications, logistics, and specific industry sectors including CODE39, ITF (Interleaved 2 of 5), MSI, and Pharmacode.
3
4
## Capabilities
5
6
### CODE39 Barcodes
7
8
CODE39 is a widely used alphanumeric barcode format popular in industrial applications, inventory management, and logistics due to its simplicity and self-checking properties.
9
10
```javascript { .api }
11
/**
12
* Generate CODE39 barcode
13
* @param content - Alphanumeric data (A-Z, 0-9, and special characters)
14
*/
15
JsBarcode(element, content, { format: "CODE39" });
16
```
17
18
**Character Set:**
19
- Letters: A-Z (uppercase only)
20
- Digits: 0-9
21
- Special characters: - . (space) $ / + %
22
- Start/Stop: * (automatically added)
23
24
**Usage Examples:**
25
26
```javascript
27
// Basic alphanumeric
28
JsBarcode("#barcode", "PRODUCT123", { format: "CODE39" });
29
30
// With special characters
31
JsBarcode("#barcode", "ITEM-456.789", { format: "CODE39" });
32
33
// Spaces allowed
34
JsBarcode("#barcode", "PART A123", { format: "CODE39" });
35
36
// Mixed special characters
37
JsBarcode("#barcode", "ORDER$100/25+TAX", { format: "CODE39" });
38
```
39
40
### ITF (Interleaved 2 of 5)
41
42
ITF encodes pairs of digits in an interleaved pattern, making it highly efficient for numeric data. Commonly used for shipping labels and warehouse applications.
43
44
```javascript { .api }
45
/**
46
* Generate ITF barcode
47
* @param content - Even number of digits (pairs are required)
48
*/
49
JsBarcode(element, content, { format: "ITF" });
50
```
51
52
**Requirements:**
53
- Must contain even number of digits
54
- Digits only (0-9)
55
- Minimum 2 digits (1 pair)
56
57
**Usage Examples:**
58
59
```javascript
60
// Even number of digits
61
JsBarcode("#barcode", "1234567890", { format: "ITF" });
62
63
// Shipping codes
64
JsBarcode("#barcode", "123456789012345678", { format: "ITF" });
65
66
// Warehouse tracking
67
JsBarcode("#barcode", "20250101", { format: "ITF" }); // Date: 2025-01-01
68
69
// Carton numbers
70
JsBarcode("#barcode", "001234", { format: "ITF" });
71
```
72
73
### ITF-14 (GTIN-14)
74
75
ITF-14 is a specialized version of ITF used for encoding GTIN-14 codes, commonly used for shipping containers and case-level identification in retail supply chains.
76
77
```javascript { .api }
78
/**
79
* Generate ITF-14 barcode with automatic checksum
80
* @param content - 13 or 14 digit GTIN (checksum calculated if 13 digits)
81
*/
82
JsBarcode(element, content, { format: "ITF14" });
83
```
84
85
**Usage Examples:**
86
87
```javascript
88
// 13 digits - checksum automatically calculated
89
JsBarcode("#barcode", "1234567890123", { format: "ITF14" });
90
91
// 14 digits - validates existing checksum
92
JsBarcode("#barcode", "12345678901231", { format: "ITF14" });
93
94
// Case codes (GTIN-14)
95
JsBarcode("#barcode", "2501234567890", { format: "ITF14" });
96
97
// Shipping container codes
98
JsBarcode("#barcode", "1501234567890", { format: "ITF14" });
99
```
100
101
### MSI Barcodes
102
103
MSI (Modified Plessey) is a numeric-only format commonly used in inventory control and library systems, with various checksum options for error detection.
104
105
```javascript { .api }
106
/**
107
* Generate MSI barcode (no checksum)
108
* @param content - Numeric digits only
109
*/
110
JsBarcode(element, content, { format: "MSI" });
111
112
/**
113
* Generate MSI barcode with Mod10 checksum
114
* @param content - Numeric digits (checksum automatically added)
115
*/
116
JsBarcode(element, content, { format: "MSI10" });
117
118
/**
119
* Generate MSI barcode with Mod11 checksum
120
* @param content - Numeric digits (checksum automatically added)
121
*/
122
JsBarcode(element, content, { format: "MSI11" });
123
124
/**
125
* Generate MSI barcode with double Mod10 checksum
126
* @param content - Numeric digits (double checksum automatically added)
127
*/
128
JsBarcode(element, content, { format: "MSI1010" });
129
130
/**
131
* Generate MSI barcode with Mod11 + Mod10 checksum
132
* @param content - Numeric digits (dual checksum automatically added)
133
*/
134
JsBarcode(element, content, { format: "MSI1110" });
135
```
136
137
**Usage Examples:**
138
139
```javascript
140
// Basic MSI (no checksum)
141
JsBarcode("#barcode", "123456789", { format: "MSI" });
142
143
// With Mod10 checksum for error detection
144
JsBarcode("#barcode", "123456789", { format: "MSI10" });
145
146
// With Mod11 checksum (higher error detection)
147
JsBarcode("#barcode", "123456789", { format: "MSI11" });
148
149
// Double Mod10 for maximum reliability
150
JsBarcode("#barcode", "123456789", { format: "MSI1010" });
151
152
// Mod11 + Mod10 combination
153
JsBarcode("#barcode", "123456789", { format: "MSI1110" });
154
155
// Library book tracking
156
JsBarcode("#barcode", "000123456", { format: "MSI10" });
157
158
// Inventory control
159
JsBarcode("#barcode", "987654321", { format: "MSI1010" });
160
```
161
162
### Pharmacode
163
164
Pharmacode is a specialized format used in the pharmaceutical industry for drug packaging and tracking, encoding numbers within a specific range.
165
166
```javascript { .api }
167
/**
168
* Generate Pharmacode barcode
169
* @param content - Number between 3 and 131070
170
*/
171
JsBarcode(element, content, { format: "pharmacode" });
172
```
173
174
**Requirements:**
175
- Numeric input only
176
- Range: 3 to 131,070 (inclusive)
177
- Used for pharmaceutical packaging
178
179
**Usage Examples:**
180
181
```javascript
182
// Basic pharmacode
183
JsBarcode("#barcode", "12345", { format: "pharmacode" });
184
185
// Minimum value
186
JsBarcode("#barcode", "3", { format: "pharmacode" });
187
188
// Maximum value
189
JsBarcode("#barcode", "131070", { format: "pharmacode" });
190
191
// Pharmaceutical product codes
192
JsBarcode("#barcode", "98765", { format: "pharmacode" });
193
194
// Drug package tracking
195
JsBarcode("#barcode", "54321", { format: "pharmacode" });
196
```
197
198
## Validation and Error Handling
199
200
### CODE39 Validation
201
202
```javascript
203
// Valid characters
204
JsBarcode("#barcode", "VALID123-.", {
205
format: "CODE39",
206
valid: function(isValid) {
207
console.log("CODE39 valid:", isValid); // true
208
}
209
});
210
211
// Invalid characters (lowercase, special chars)
212
JsBarcode("#barcode", "invalid@#", {
213
format: "CODE39",
214
valid: function(isValid) {
215
if (!isValid) {
216
console.log("CODE39 allows only: A-Z, 0-9, -.$/+%");
217
}
218
}
219
});
220
```
221
222
### ITF Validation
223
224
```javascript
225
// Valid even-length numeric
226
JsBarcode("#barcode", "123456", {
227
format: "ITF",
228
valid: function(isValid) {
229
console.log("ITF valid:", isValid); // true
230
}
231
});
232
233
// Invalid odd-length
234
JsBarcode("#barcode", "12345", {
235
format: "ITF",
236
valid: function(isValid) {
237
if (!isValid) {
238
console.log("ITF requires even number of digits");
239
}
240
}
241
});
242
```
243
244
### ITF-14 Validation
245
246
```javascript { .api }
247
/**
248
* ITF-14 validation
249
* @param data - Input string
250
* @returns boolean - True if 13-14 digits with valid checksum
251
*/
252
// Accepts: /^[0-9]{13,14}$/ with checksum validation for 14-digit codes
253
```
254
255
### MSI Validation
256
257
```javascript { .api }
258
/**
259
* MSI validation (all variants)
260
* @param data - Input string
261
* @returns boolean - True if contains only digits
262
*/
263
// Accepts: /^[0-9]+$/ - any length numeric string
264
```
265
266
### Pharmacode Validation
267
268
```javascript
269
// Valid range
270
JsBarcode("#barcode", "12345", {
271
format: "pharmacode",
272
valid: function(isValid) {
273
console.log("Pharmacode valid:", isValid); // true
274
}
275
});
276
277
// Out of range
278
JsBarcode("#barcode", "2", {
279
format: "pharmacode",
280
valid: function(isValid) {
281
if (!isValid) {
282
console.log("Pharmacode must be between 3 and 131070");
283
}
284
}
285
});
286
```
287
288
## Industry-Specific Applications
289
290
### Manufacturing and Inventory
291
292
```javascript
293
// Part numbers with CODE39
294
JsBarcode("#part-barcode", "PART-A123.456", {
295
format: "CODE39",
296
height: 50,
297
width: 2,
298
displayValue: true,
299
fontSize: 12
300
});
301
302
// Carton tracking with ITF
303
JsBarcode("#carton-barcode", "123456789012", {
304
format: "ITF",
305
height: 80,
306
width: 3,
307
margin: 15
308
});
309
```
310
311
### Shipping and Logistics
312
313
```javascript
314
// GTIN-14 for case-level tracking
315
JsBarcode("#case-barcode", "1234567890123", {
316
format: "ITF14",
317
height: 100,
318
width: 2,
319
displayValue: true,
320
textPosition: "bottom"
321
});
322
323
// Shipping container codes
324
JsBarcode("#container-barcode", "098765432109876543", {
325
format: "ITF",
326
height: 60,
327
width: 2,
328
background: "#ffffff",
329
lineColor: "#000000"
330
});
331
```
332
333
### Library and Asset Management
334
335
```javascript
336
// Library book tracking with MSI
337
JsBarcode("#book-barcode", "000123456789", {
338
format: "MSI10",
339
height: 40,
340
width: 1,
341
fontSize: 10,
342
displayValue: true
343
});
344
345
// Asset tags with MSI double checksum
346
JsBarcode("#asset-barcode", "987654321", {
347
format: "MSI1010",
348
height: 30,
349
width: 2,
350
margin: 5
351
});
352
```
353
354
### Pharmaceutical Applications
355
356
```javascript
357
// Drug package codes
358
JsBarcode("#drug-barcode", "98765", {
359
format: "pharmacode",
360
height: 30,
361
width: 4,
362
displayValue: false, // Often no text shown
363
background: "#ffffff",
364
lineColor: "#000000"
365
});
366
367
// Pharmaceutical batch tracking
368
JsBarcode("#batch-barcode", "54321", {
369
format: "pharmacode",
370
height: 25,
371
width: 3,
372
margin: 2
373
});
374
```
375
376
## Performance and Best Practices
377
378
### Format Selection Guidelines
379
380
```javascript
381
// Choose CODE39 for:
382
// - Mixed alphanumeric data
383
// - Industrial environments
384
// - Self-checking requirements
385
// - Legacy system compatibility
386
387
// Choose ITF for:
388
// - Purely numeric data (even length)
389
// - High-density requirements
390
// - Shipping/logistics applications
391
// - Case/carton identification
392
393
// Choose MSI for:
394
// - Library systems
395
// - Inventory tracking
396
// - When specific checksum requirements exist
397
// - Numeric-only applications
398
399
// Choose Pharmacode for:
400
// - Pharmaceutical packaging
401
// - Drug identification
402
// - Regulatory compliance
403
// - Small package applications
404
```
405
406
### Error Prevention
407
408
```javascript
409
function generateIndustrialBarcode(data, format) {
410
// Pre-validate data format
411
const validators = {
412
"CODE39": /^[A-Z0-9\-\.\s\$\/\+\%]+$/,
413
"ITF": /^[0-9]*$/ && data.length % 2 === 0,
414
"MSI": /^[0-9]+$/,
415
"pharmacode": /^[0-9]+$/ && parseInt(data) >= 3 && parseInt(data) <= 131070
416
};
417
418
if (validators[format]) {
419
JsBarcode("#barcode", data, {
420
format: format,
421
valid: function(isValid) {
422
if (isValid) {
423
console.log(`${format} barcode generated successfully`);
424
} else {
425
console.error(`Invalid ${format} data: ${data}`);
426
}
427
}
428
});
429
} else {
430
console.error(`Unsupported format: ${format}`);
431
}
432
}
433
```