Skip to content

Commit 12246f8

Browse files
committed
chore: wip
chore: wip
1 parent 8db1fbb commit 12246f8

10 files changed

Lines changed: 622 additions & 0 deletions

File tree

.vscode/dictionary.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,19 @@ dtsx
2222
entrypoints
2323
gexp
2424
glog
25+
GTIN
2526
heroicons
2627
iconify
2728
jsbarcode
2829
Kazuhiko
2930
localtunnels
3031
lockb
32+
OCRB
3133
openweb
3234
outdir
3335
pausable
3436
pharmacode
37+
Plessey
3538
Postcardware
3639
prefetch
3740
preinstall

docs/barcodes/CODE128.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# CODE128
2+
3+
CODE128 is one of the more versatile barcodes. It has support for all 128 ASCII characters but does also encode numbers efficiently. It has three modes (A/B/C) but can switch between them at any time. CODE128 is the default barcode that barcode will choose if nothing else is specified.
4+
5+
## Supported Modes
6+
7+
***Auto (recommended)***
8+
9+
```ts
10+
import { barcode } from '@stacksjs/qrx'
11+
12+
barcode('#barcode', 'Example1234') // CODE128 (auto) is the default mode
13+
barcode('#barcode', 'Example1234', { format: 'CODE128' }) // But you can still specify it
14+
```
15+
16+
***Forced modes***
17+
18+
If the barcode scanner only supports one type of CODE128 you can force that mode.
19+
20+
```ts
21+
import { barcode } from '@stacksjs/qrx'
22+
23+
barcode('#barcode', 'EXAMPLE\n1234', { format: 'CODE128A' })
24+
barcode('#barcode', 'Example1234', { format: 'CODE128B' })
25+
barcode('#barcode', '12345678', { format: 'CODE128C' })
26+
```
27+
28+
## `ean128` option for CODE128
29+
30+
Enable encoding CODE128 as GS1-128/EAN-128.
31+
32+
```ts
33+
import { barcode } from '@stacksjs/qrx'
34+
35+
barcode('#barcode', '12345678', {
36+
format: 'CODE128C',
37+
ean128: true
38+
})
39+
```
40+
41+
## Non printable characters
42+
43+
CODE128 supports all 128 ASCII characters. You can input them in a few ways.
44+
45+
Here are some examples of how to encode *newlines*, *tabs*, and *carriage returns*.
46+
47+
```ts
48+
import { barcode } from '@stacksjs/qrx'
49+
50+
barcode('#barcode', '\n\t\r')
51+
barcode('#barcode', '\x0A\x09\x0D')
52+
barcode('#barcode', String.fromCharCode(10, 9, 13))
53+
```
54+
55+
For information about all ASCII character, see [ASCII Table](https://www.asciitable.com/).

docs/barcodes/CODE39.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# CODE39
2+
3+
CODE39 is an old barcode type that can encode numbers, uppercase letters and a number of special characters (`-`, `.`, `$`, `/`, `+`, `%`, and `space`). It has been a common barcode type in the past but CODE128 is recommended if not for legacy reasons.
4+
5+
## Example
6+
7+
```ts
8+
import { barcode } from '@stacksjs/qrx'
9+
10+
barcode('#barcode', 'CODE39 Barcode', {
11+
format: 'CODE39'
12+
})
13+
```
14+
15+
![CODE39 Barcode](http://i.imgur.com/gqvVBrp.png)
16+
17+
## Mod43 checksum
18+
19+
Code 39 is sometimes used with an optional modulo 43 check digit. Using it requires this feature to be enabled in the barcode reader. It is enabled by setting the `mod43` option to `true`.
20+
21+
```ts
22+
import { barcode } from '@stacksjs/qrx'
23+
24+
barcode('#barcode', 'ABCDEFG', {
25+
format: 'CODE39',
26+
mod43: true
27+
})
28+
```
29+
30+
![CODE39 Barcode](http://i.imgur.com/thX3q8B.png)

docs/barcodes/Codabar.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Codabar
2+
3+
Codabar is an old barcode type that can encode numbers and a number of special characters (``, `$`, `:`, `/`, `+`, `.`).
4+
5+
You can set start and stop characters to `A`, `B`, `C` or `D` but if no start and stop character is defined `A` will be used.
6+
7+
## Example
8+
9+
```ts
10+
import { barcode } from '@stacksjs/qrx'
11+
12+
barcode('#barcode', '1234567890', {
13+
format: 'codabar'
14+
})
15+
```
16+
17+
![CodabarBarcode](http://i.imgur.com/nzAVIl3.png)
18+
19+
```ts
20+
import { barcode } from '@stacksjs/qrx'
21+
22+
barcode('#barcode', 'C1234567890D', {
23+
format: 'codabar'
24+
})
25+
```
26+
27+
![CodabarBarcode](http://i.imgur.com/TEdMAqp.png)

docs/barcodes/EAN.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# EAN
2+
3+
EAN comes in a variety of forms, most commonly used is EAN-13 (GTIN-13) that is used on world wide to marking the identity of products.
4+
5+
`qrx` supports the formats EAN-13, EAN-8 and UPC as well as the barcode addons EAN-5 and EAN-2.
6+
7+
## Supported modes
8+
9+
```ts
10+
import { barcode } from '@stacksjs/qrx'
11+
12+
barcode('#barcode', '5901234123457', { format: 'EAN13' })
13+
barcode('#barcode', '123456789999', { format: 'UPC' })
14+
barcode('#barcode', '96385074', { format: 'EAN8' })
15+
barcode('#barcode', '54495', { format: 'EAN5' })
16+
barcode('#barcode', '53', { format: 'EAN2' })
17+
```
18+
19+
## Addon EAN-5 / EAN-2
20+
21+
EAN-5 and EAN-2 is addon barcodes an is always used combined with EAN-13 or EAN-8.
22+
The advanced barcode syntax can be used to add these addons to the barcodes.
23+
24+
```ts
25+
import { barcode } from '@stacksjs/qrx'
26+
27+
barcode('#barcode')
28+
.EAN13('1234567890128')
29+
.blank(20) // An blank creates a space between the barcodes
30+
.EAN5('12345', { height: 85, textPosition: 'top', fontSize: 16 })
31+
.render()
32+
```
33+
34+
![EAN-13 + EAN-5](http://i.imgur.com/6GKSc9e.png)
35+
36+
## `flat` options for EAN-13, EAN-8 and UPC
37+
38+
EAN-13, EAN-8 and UPC barcodes is most often used with "guard bars". If you don't want these and instead a flat rendering you can specify the `flat` option and skip the guard bars.
39+
40+
```ts
41+
import { barcode } from '@stacksjs/qrx'
42+
43+
barcode('#barcode', '1234567890128', {
44+
format: 'ean13',
45+
flat: true
46+
})
47+
```
48+
49+
![flat EAN-13](http://i.imgur.com/UGu1sbo.png)
50+
51+
## `lastChar` options for EAN-13
52+
53+
EAN-13 is sometimes printed with with a character after the barcode, most common is the `>` character. This is supported in barcode with the `lastChar` option.
54+
55+
```ts
56+
import { barcode } from '@stacksjs/qrx'
57+
58+
barcode('#barcode', '1234567890128', {
59+
format: 'ean13',
60+
lastChar: '>'
61+
})
62+
```
63+
64+
![lastChar example](http://i.imgur.com/XgQEbmI.png)
65+
66+
## OCR-B font
67+
68+
When creating an EAN or UPC barcode it is standard to use the [OCR-B](https://en.wikipedia.org/wiki/OCR-B) font. Most variants of this font is not free. There are free versions but none that (we have found) that have the correct license to be able to include in the barcode repository.
69+
70+
When using a custom font with barcode you can specify the font with [@font-face](https://developer.mozilla.org/en/docs/Web/CSS/@font-face) and then do the barcode call. Note that the font has to be loaded before the generation can be made correctly.
71+
72+
```ts
73+
barcode('#canvasBarcode', '123456789012', {
74+
format: 'EAN13',
75+
font: 'OCRB',
76+
fontSize: 18,
77+
textMargin: 0
78+
})
79+
```
80+
81+
![Barcode with OCR-B font](http://i.imgur.com/g0cWEQc.png)
82+
83+
## Check digits
84+
85+
EAN-13, UPC and EAN-8 all have the last digit being a check digit to verify the content that is encoded. This digit is considered a part of the number and barcode will verify it before generating the barcode.
86+
87+
If the last digit of these barcodes are not specified it will automatically be calculated and added.
88+
89+
```ts
90+
barcode('#barcode', '96385074', { format: 'EAN8' })
91+
// These two are generating identical barcodes
92+
barcode('#barcode', '9638507', { format: 'EAN8' })
93+
```

docs/barcodes/ITF-14.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ITF-14
2+
3+
ITF-14 (Interleaved Two of Five) is the GS1 implementation of an Interleaved 2 of 5 bar code to encode a Global Trade Item Number. ITF-14 symbols are generally used on packaging levels of a product, such as a case box of 24 cans of soup. The ITF-14 will always encode 14 digits.
4+
5+
The last digit of an ITF-14 barcode is an checksum. It is normally included but qrx can automatically calculate it for you if it is left out.
6+
7+
## Example
8+
9+
```ts
10+
import { barcode } from '@stacksjs/qrx'
11+
12+
barcode('#barcode', '12345678901231', {
13+
format: 'ITF14'
14+
})
15+
```
16+
17+
![ITF-14 Barcode](http://i.imgur.com/GqbdWrg.png)

docs/barcodes/MSI.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# MSI
2+
3+
MSI or *Modified Plessey* is a barcode developed by the MSI Data Corporation and is primarily used for inventory control, marking storage containers and shelves in warehouse environments. It supports digits 0-9. `qrx` provides automatic checksum calculation of *Mod 10*, *Mod 11*, *Mod 1010* and *Mod 1110*.
4+
5+
## Supported modes
6+
7+
```ts
8+
import { barcode } from '@stacksjs/qrx'
9+
10+
barcode('#barcode', '1234', { format: 'MSI' }) // Result: 1234
11+
barcode('#barcode', '1234', { format: 'MSI10' }) // Result: 12344
12+
barcode('#barcode', '1234', { format: 'MSI11' }) // Result: 12343
13+
barcode('#barcode', '1234', { format: 'MSI1010' }) // Result: 123448
14+
barcode('#barcode', '1234', { format: 'MSI1110' }) // Result: 123430
15+
```
16+
17+
## Example
18+
19+
```ts
20+
import { barcode } from '@stacksjs/qrx'
21+
22+
barcode('#barcode', '123456789', {
23+
format: 'MSI'
24+
})
25+
```
26+
27+
![MSI Barcode](http://i.imgur.com/cm4ZQpE.png)

docs/barcodes/Pharmacode.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Pharmacode
2+
3+
Pharmacode is a barcode used in the pharmaceutical industry. It can encode numbers 3 to 131070.
4+
5+
## Example
6+
7+
```ts
8+
import { barcode } from '@stacksjs/qrx'
9+
10+
barcode('#barcode', '1234', {
11+
format: 'pharmacode',
12+
width: 4,
13+
height: 40,
14+
displayValue: false
15+
})
16+
```
17+
18+
![Pharmacode](http://i.imgur.com/j6XZOoL.png)

docs/barcodes/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Barcodes
2+
3+
A list of all the barcode types supported by qrx:
4+
5+
- [Codabar](./Codabar.md)
6+
- [CODE39](./CODE39.md)
7+
- [CODE128](./CODE128.md)
8+
- [EAN](./EAN.md)
9+
- [ITF-14](./ITF-14.md)
10+
- [MSI](./MSI.md)
11+
- [Pharmacode](./Pharmacode.md)

0 commit comments

Comments
 (0)