Class QrOptions
Represents the options for a QR code, including error correction level, version, and character encoding.
Inheritance
Namespace: IronQr
Assembly: IronQr.dll
Syntax
public sealed class QrOptions : ValueType
The encoding settings for a generated QR code, its symbol type, recovery level, version, and character set, are carried by QrOptions. It is passed to a QrWriter.Write overload, so the choices that shape the symbol are made at generation time rather than after.
Encoding selects the QrEncoding family, ErrorCorrectionLevel sets the QrErrorCorrectionLevel redundancy, Version is a Nullable<int> that fixes the symbol version and therefore its capacity (left null, the writer picks the smallest that fits), and CharacterEncoding names the text encoding, such as UTF-8, for non-ASCII payloads. The two constructors let a developer pass the error-correction level alone or the full set. The character encoding matters for payloads outside ASCII, such as accented text or non-Latin scripts, where UTF-8 keeps the decoded value intact. Matching the write options when reading a code is not required, since detection is format-driven rather than configured.
var options = new QrOptions(QrEncoding.QRCode, QrErrorCorrectionLevel.High);
QrCode qr = QrWriter.Write("https://ironsoftware.com", options);The generate QR code example writes with options, and the error correction how-to covers the recovery setting.
Constructors
QrOptions(QrEncoding, QrErrorCorrectionLevel, Nullable<Int32>, String)
Initializes a new instance of the QrOptions struct with specified QR encoding, error correction level, version, and character encoding.
Declaration
public QrOptions(QrEncoding encoding, QrErrorCorrectionLevel errorCorrectionLevel, Nullable<int> version = null, string characterEncoding = "ISO-8859-1")
Parameters
| Type | Name | Description |
|---|---|---|
| QrEncoding | encoding | Encoding type of the QR. Defaults to regular QR code. |
| QrErrorCorrectionLevel | errorCorrectionLevel | The error correction or fault tolerance level of the QR code. Defaults to the highest level. |
| System.Nullable<System.Int32> | version | The symbol version of the QR code from 1-40. Defaults to null, which automatically assigns an appropriate version. |
| System.String | characterEncoding | The character encoding for binary data. Defaults to "ISO-8859-1". |
QrOptions(QrErrorCorrectionLevel, Nullable<Int32>, String)
Initializes a new instance of the QrOptions struct with specified error correction level, version, and character encoding.
Declaration
public QrOptions(QrErrorCorrectionLevel errorCorrectionLevel, Nullable<int> version = null, string characterEncoding = "ISO-8859-1")
Parameters
| Type | Name | Description |
|---|---|---|
| QrErrorCorrectionLevel | errorCorrectionLevel | The error correction or fault tolerance level of the QR code. Defaults to the highest level. |
| System.Nullable<System.Int32> | version | The symbol version of the QR code from 1-40. Defaults to null, which automatically assigns an appropriate version. |
| System.String | characterEncoding | The character encoding for binary data. Defaults to "ISO-8859-1". |
Properties
CharacterEncoding
The default character encoding for binary data.
Declaration
public string CharacterEncoding { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Encoding
The encoding type of the QR.
Declaration
public QrEncoding Encoding { get; set; }
Property Value
| Type | Description |
|---|---|
| QrEncoding |
ErrorCorrectionLevel
The error correction or fault tolerance level of a QR code. A higher QrErrorCorrectionLevel creates more complex QR codes, which are less prone to reading errors. They may also be readable if damaged or partially obscured.
Declaration
public QrErrorCorrectionLevel ErrorCorrectionLevel { get; set; }
Property Value
| Type | Description |
|---|---|
| QrErrorCorrectionLevel |
Version
The symbol version of the QR Code. The default value 0 will automatically assign an appropriate QR version for your data (highly recommended).
Higher version numbers generate a more complex graphic and can encode more data. Lower version numbers generate simpler QR codes that may be more readable at a distance.
Declaration
public Nullable<int> Version { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.Int32> |