Table of Contents

Class TwQrCodeService

Namespace
TwBlazor.Services
Assembly
TwBlazor.dll

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

data byte[]

The bytes to encode.

options QrEncodeOptions

The encoding settings, or null for Default.

Returns

QrMatrix

The encoded matrix.

Exceptions

ArgumentNullException

data is 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

value string

The text to encode, for example a URL.

options QrEncodeOptions

The encoding settings, or null for Default.

Returns

QrMatrix

The encoded matrix.

Exceptions

ArgumentNullException

value is 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

value string

The text to encode.

options QrEncodeOptions

The encoding settings, or null for Default.

matrix QrMatrix

The encoded matrix, or null when the text does not fit.

Returns

bool

true when the text was encoded.