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
+
Modes can be used to encode a string in a more efficient way.
224
225
A mode may be more suitable than others depending on the string content.
225
226
A list of supported modes are shown in the table below:
226
227
@@ -231,18 +232,18 @@ A list of supported modes are shown in the table below:
231
232
| Kanji | Characters from the Shift JIS system based on JIS X 0208 | 2 kanji are represented by 13 bits |
232
233
| Byte | Characters from the ISO/IEC 8859-1 character set | Each characters are represented by 8 bits |
233
234
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>
235
+
Choose the right mode may be tricky if the input text is unknown.
236
+
In these cases **Byte** mode is the best choice since all characters can be encoded with it. (See [Multibyte characters](#multibyte-characters))
236
237
However, if the QR Code reader supports mixed modes, using [Auto mode](#auto-mode) may produce better results.
237
238
238
239
### 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>
240
+
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
241
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
242
See [Manual mode](#manual-mode) for an example of how to specify segments with different encoding modes.
242
243
243
244
### 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>
245
+
By **default**, automatic mode selection is used.
246
+
The input string is automatically splitted in various segments optimized to produce the shortest possible bitstream using mixed modes.
246
247
This is the preferred way to generate the QR Code.
247
248
248
249
For example, the string **ABCDE12345678?A1A** will be splitted in 3 segments with the following modes:
@@ -253,12 +254,12 @@ For example, the string **ABCDE12345678?A1A** will be splitted in 3 segments wit
253
254
| 12345678 | Numeric |
254
255
| ?A1A | Byte |
255
256
256
-
Any other combinations of segments and modes will result in a longer bitstream.<br>
257
+
Any other combinations of segments and modes will result in a longer bitstream.
257
258
If you need to keep the QR Code size small, this mode will produce the best results.
258
259
259
260
### Manual mode
260
261
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>
262
+
In this way no segment optimizations will be applied under the hood.
262
263
Segments list can be passed as an array of object:
263
264
264
265
```javascript
@@ -275,8 +276,8 @@ Segments list can be passed as an array of object:
275
276
```
276
277
277
278
### 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>
279
+
With kanji mode is possible to encode characters from the Shift JIS system in an optimized way.
280
+
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
281
This table is not included by default in the bundle to keep the size as small as possible.
281
282
282
283
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 +684,76 @@ Text to encode or a list of objects describing segments.
683
684
##### `options`
684
685
See [Options](#options).
685
686
686
-
<br>
687
+
687
688
688
689
### Options
689
690
690
691
#### QR Code options
691
692
##### `version`
692
-
Type: `Number`<br>
693
+
Type: `Number`
693
694
694
695
QR Code version. If not specified the more suitable value will be calculated.
695
696
696
697
##### `errorCorrectionLevel`
697
-
Type: `String`<br>
698
+
Type: `String`
698
699
Default: `M`
699
700
700
-
Error correction level.<br>
701
+
Error correction level.
701
702
Possible values are `low, medium, quartile, high` or `L, M, Q, H`.
702
703
703
704
##### `maskPattern`
704
-
Type: `Number`<br>
705
+
Type: `Number`
705
706
706
-
Mask pattern used to mask the symbol.<br>
707
-
Possible values are `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`.<br>
707
+
Mask pattern used to mask the symbol.
708
+
Possible values are `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`.
708
709
If not specified the more suitable value will be calculated.
709
710
710
711
##### `toSJISFunc`
711
-
Type: `Function`<br>
712
+
Type: `Function`
712
713
713
-
Helper function used internally to convert a kanji to its Shift JIS value.<br>
714
+
Helper function used internally to convert a kanji to its Shift JIS value.
714
715
Provide this function if you need support for Kanji mode.
715
716
716
717
#### Renderers options
717
718
##### `margin`
718
-
Type: `Number`<br>
719
+
Type: `Number`
719
720
Default: `4`
720
721
721
722
Define how much wide the quiet zone should be.
722
723
723
724
##### `scale`
724
-
Type: `Number`<br>
725
+
Type: `Number`
725
726
Default: `4`
726
727
727
728
Scale factor. A value of `1` means 1px per modules (black dots).
728
729
729
730
##### `small`
730
-
Type: `Boolean`<br>
731
+
Type: `Boolean`
731
732
Default: `false`
732
733
733
734
Relevant only for terminal renderer. Outputs smaller QR code.
734
735
735
736
##### `width`
736
-
Type: `Number`<br>
737
+
Type: `Number`
737
738
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>
739
+
Forces a specific width for the output image.
740
+
If width is too small to contain the qr symbol, this option will be ignored.
740
741
Takes precedence over `scale`.
741
742
742
743
##### `color.dark`
743
-
Type: `String`<br>
744
+
Type: `String`
744
745
Default: `#000000ff`
745
746
746
-
Color of dark module. Value must be in hex format (RGBA).<br>
747
+
Color of dark module. Value must be in hex format (RGBA).
747
748
Note: dark color should always be darker than `color.light`.
748
749
749
750
##### `color.light`
750
-
Type: `String`<br>
751
+
Type: `String`
751
752
Default: `#ffffffff`
752
753
753
-
Color of light module. Value must be in hex format (RGBA).<br>
754
+
Color of light module. Value must be in hex format (RGBA).
754
755
755
-
<br>
756
+
756
757
757
758
## GS1 QR Codes
758
759
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