Class QrSegmentAdvanced
Advanced methods for encoding QR codes using Kanji mode or using multiple segments with different encodings.
Inheritance
Inherited Members
Namespace: Net.Codecrete.QrCodeGenerator
Assembly: QrCodeGenerator.dll
Syntax
public static class QrSegmentAdvanced
Methods
| Improve this Doc View SourceIsEncodableAsKanji(String)
Tests whether the specified string can be encoded as a segment in Kanji mode.
Broadly speaking, the set of encodable characters are Kanji used in Japan, Hiragana, Katakana, East Asian punctuation, full-width ASCII, Greek, and Cyrillic. Examples of non-encodable characters include ordinary ASCII, half-width Katakana, more extensive Chinese Hanzi.
Declaration
public static bool IsEncodableAsKanji(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to test for encodability. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
MakeKanji(String)
Creates a segment encoding the specified text in Kanji mode.
Broadly speaking, the set of encodable characters are Kanji used in Japan, Hiragana, Katakana, East Asian punctuation, full-width ASCII, Greek, and Cyrillic. Examples of non-encodable characters include ordinary ASCII, half-width Katakana, more extensive Chinese Hanzi.
Declaration
public static QrSegment MakeKanji(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to encoding, containing only characters allowed by the Kanji encoding. |
Returns
Type | Description |
---|---|
QrSegment | The created segment representing the specified text. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentOutOfRangeException |
|
See Also
| Improve this Doc View SourceMakeSegmentsOptimally(String, QrCode.Ecc, Int32, Int32)
Creates a list of zero or more segments to represent the specified text string. The resulting list optimally minimizes the total encoded bit length, subjected to the constraints of the specified error correction level, minimum and maximum version number.
This function potentially uses all four text encoding modes: numeric, alphanumeric, byte (UTF-8), and Kanji. It is a more sophisticated but slower replacement for MakeSegments(String).
The text to be encoded can contain the full set of Unicode characters (code points).
Declaration
public static List<QrSegment> MakeSegmentsOptimally(string text, QrCode.Ecc ecl, int minVersion = 1, int maxVersion = 40)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to be encoded. |
QrCode.Ecc | ecl | The error correction level to use. |
System.Int32 | minVersion | The minimum version (size) of the QR code (between 1 and 40). |
System.Int32 | maxVersion | The maximum version (size) of the QR code (between 1 and 40). |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<QrSegment> | The created mutable list of segments encoding the specified text with a minimal bit length. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentOutOfRangeException | 1 ≤ minVersion ≤ maxVersion ≤ 40 is violated. |
DataTooLongException | The text is too long to fit into the QR code with the given encoding parameters. |