You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modes can be used to encode a string in a more efficient way.<br>
224
-
A mode may be more suitable than others depending on the string content.
225
+
Modes can be used to encode a string in a more efficient way.
226
+
A mode may be more suitable than the others depending on the data content.
225
227
A list of supported modes are shown in the table below:
226
228
227
229
| Mode | Characters | Compression |
@@ -231,18 +233,18 @@ A list of supported modes are shown in the table below:
231
233
| Kanji | Characters from the Shift JIS system based on JIS X 0208 | 2 kanji are represented by 13 bits |
232
234
| Byte | Characters from the ISO/IEC 8859-1 character set | Each characters are represented by 8 bits |
233
235
234
-
Choose the right mode may be tricky if the input text is unknown.<br>
235
-
In these cases **Byte** mode is the best choice since all characters can be encoded with it. (See[Multibyte characters](#multibyte-characters))<br>
236
+
Choosing the right mode may be tricky if the input text is unknown.
237
+
In these cases **Byte** mode is the best choice since all characters can be encoded with it (see[Multibyte characters](#multibyte-characters)).
236
238
However, if the QR Code reader supports mixed modes, using [Auto mode](#auto-mode) may produce better results.
237
239
238
240
### Mixed modes
239
-
Mixed modes are also possible. A QR code can be generated from a series of segments having different encoding modes to optimize the data compression.<br>
241
+
Mixed modes are also possible. A QR code can be generated from a series of segments having different encoding modes to optimize the data compression.
240
242
However, switching from a mode to another has a cost which may lead to a worst result if it's not taken into account.
241
243
See [Manual mode](#manual-mode) for an example of how to specify segments with different encoding modes.
242
244
243
245
### Auto mode
244
-
By **default**, automatic mode selection is used.<br>
245
-
The input string is automatically splitted in various segments optimized to produce the shortest possible bitstream using mixed modes.<br>
246
+
By **default**, automatic mode selection is used.
247
+
The input string is automatically splitted in various segments optimized to produce the shortest possible bitstream using mixed modes.
246
248
This is the preferred way to generate the QR Code.
247
249
248
250
For example, the string **ABCDE12345678?A1A** will be splitted in 3 segments with the following modes:
@@ -253,12 +255,12 @@ For example, the string **ABCDE12345678?A1A** will be splitted in 3 segments wit
253
255
| 12345678 | Numeric |
254
256
| ?A1A | Byte |
255
257
256
-
Any other combinations of segments and modes will result in a longer bitstream.<br>
258
+
Any other combinations of segments and modes will result in a longer bitstream.
257
259
If you need to keep the QR Code size small, this mode will produce the best results.
258
260
259
261
### Manual mode
260
262
If auto mode doesn't work for you or you have specific needs, is also possible to manually specify each segment with the relative mode.
261
-
In this way no segment optimizations will be applied under the hood.<br>
263
+
In this way no segment optimizations will be applied under the hood.
262
264
Segments list can be passed as an array of object:
263
265
264
266
```javascript
@@ -275,8 +277,8 @@ Segments list can be passed as an array of object:
275
277
```
276
278
277
279
### Kanji mode
278
-
With kanji mode is possible to encode characters from the Shift JIS system in an optimized way.<br>
279
-
Unfortunately, there isn't a way to calculate a Shifted JIS values from, for example, a character encoded in UTF-8, for this reason a conversion table from the input characters to the SJIS values is needed.<br>
280
+
With kanji mode is possible to encode characters from the Shift JIS system in an optimized way.
281
+
Unfortunately, there isn't a way to calculate a Shifted JIS values from, for example, a character encoded in UTF-8, for this reason a conversion table from the input characters to the SJIS values is needed.
280
282
This table is not included by default in the bundle to keep the size as small as possible.
281
283
282
284
If your application requires kanji support, you will need to pass a function that will take care of converting the input characters to appropriate values.
Writes QR Code image to stream. Only works with `png` format for now.
@@ -683,76 +685,76 @@ Text to encode or a list of objects describing segments.
683
685
##### `options`
684
686
See [Options](#options).
685
687
686
-
<br>
688
+
687
689
688
690
### Options
689
691
690
692
#### QR Code options
691
693
##### `version`
692
-
Type: `Number`<br>
694
+
Type: `Number`
693
695
694
696
QR Code version. If not specified the more suitable value will be calculated.
695
697
696
698
##### `errorCorrectionLevel`
697
-
Type: `String`<br>
699
+
Type: `String`
698
700
Default: `M`
699
701
700
-
Error correction level.<br>
702
+
Error correction level.
701
703
Possible values are `low, medium, quartile, high` or `L, M, Q, H`.
702
704
703
705
##### `maskPattern`
704
-
Type: `Number`<br>
706
+
Type: `Number`
705
707
706
-
Mask pattern used to mask the symbol.<br>
707
-
Possible values are `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`.<br>
708
+
Mask pattern used to mask the symbol.
709
+
Possible values are `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`.
708
710
If not specified the more suitable value will be calculated.
709
711
710
712
##### `toSJISFunc`
711
-
Type: `Function`<br>
713
+
Type: `Function`
712
714
713
-
Helper function used internally to convert a kanji to its Shift JIS value.<br>
715
+
Helper function used internally to convert a kanji to its Shift JIS value.
714
716
Provide this function if you need support for Kanji mode.
715
717
716
718
#### Renderers options
717
719
##### `margin`
718
-
Type: `Number`<br>
720
+
Type: `Number`
719
721
Default: `4`
720
722
721
723
Define how much wide the quiet zone should be.
722
724
723
725
##### `scale`
724
-
Type: `Number`<br>
726
+
Type: `Number`
725
727
Default: `4`
726
728
727
729
Scale factor. A value of `1` means 1px per modules (black dots).
728
730
729
731
##### `small`
730
-
Type: `Boolean`<br>
732
+
Type: `Boolean`
731
733
Default: `false`
732
734
733
735
Relevant only for terminal renderer. Outputs smaller QR code.
734
736
735
737
##### `width`
736
-
Type: `Number`<br>
738
+
Type: `Number`
737
739
738
-
Forces a specific width for the output image.<br>
739
-
If width is too small to contain the qr symbol, this option will be ignored.<br>
740
+
Forces a specific width for the output image.
741
+
If width is too small to contain the qr symbol, this option will be ignored.
740
742
Takes precedence over `scale`.
741
743
742
744
##### `color.dark`
743
-
Type: `String`<br>
745
+
Type: `String`
744
746
Default: `#000000ff`
745
747
746
-
Color of dark module. Value must be in hex format (RGBA).<br>
748
+
Color of dark module. Value must be in hex format (RGBA).
747
749
Note: dark color should always be darker than `color.light`.
748
750
749
751
##### `color.light`
750
-
Type: `String`<br>
752
+
Type: `String`
751
753
Default: `#ffffffff`
752
754
753
-
Color of light module. Value must be in hex format (RGBA).<br>
755
+
Color of light module. Value must be in hex format (RGBA).
754
756
755
-
<br>
757
+
756
758
757
759
## GS1 QR Codes
758
760
There was a real good discussion here about them. but in short any qrcode generator will make gs1 compatible qrcodes, but what defines a gs1 qrcode is a header with metadata that describes your gs1 information.
0 commit comments