Show / Hide Table of Contents

Class QrSegmentAdvanced

Advanced methods for encoding QR codes using Kanji mode or using multiple segments with different encodings.

Inheritance
System.Object
QrSegmentAdvanced
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Net.Codecrete.QrCodeGenerator
Assembly: QrCodeGenerator.dll
Syntax
public static class QrSegmentAdvanced

Methods

| Improve this Doc View Source

IsEncodableAsKanji(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

true iff each character is in the Kanji mode character set.

Exceptions
Type Condition
System.ArgumentNullException

text is null.

| Improve this Doc View Source

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

text is null.

System.ArgumentOutOfRangeException

text contains non-encodable characters.

See Also
IsEncodableAsKanji(String)
| Improve this Doc View Source

MakeSegmentsOptimally(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

text or ecl is null.

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.

See Also

QrSegment
QrCode
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX