Class TwQrCodeService
The default ITwQrCodeService, built on the library's own ISO/IEC 18004 encoder.
public sealed class TwQrCodeService : ITwQrCodeService
- Inheritance
-
TwQrCodeService
- Implements
- Inherited Members
Constructors
TwQrCodeService()
public TwQrCodeService()
Methods
Encode(byte[], QrEncodeOptions?)
Encodes raw bytes into a QR code.
public QrMatrix Encode(byte[] data, QrEncodeOptions? options = null)
Parameters
databyte[]The bytes to encode.
optionsQrEncodeOptions
Returns
- QrMatrix
The encoded matrix.
Exceptions
- ArgumentNullException
datais null.- SymbolEncodingException
The data does not fit at the requested error correction level.
Encode(string, QrEncodeOptions?)
Encodes text into a QR code, using the densest mode the text allows (numeric, alphanumeric or UTF-8 bytes).
public QrMatrix Encode(string value, QrEncodeOptions? options = null)
Parameters
valuestringThe text to encode, for example a URL.
optionsQrEncodeOptions
Returns
- QrMatrix
The encoded matrix.
Exceptions
- ArgumentNullException
valueis null.- SymbolEncodingException
The text does not fit at the requested error correction level.
TryEncode(string?, QrEncodeOptions?, out QrMatrix?)
Tries to encode text into a QR code, without throwing when it is too long.
public bool TryEncode(string? value, QrEncodeOptions? options, out QrMatrix? matrix)
Parameters
valuestringThe text to encode.
optionsQrEncodeOptionsmatrixQrMatrixThe encoded matrix, or null when the text does not fit.