encode

fun encode(data: String, errorCorrection: QrErrorCorrection = QrErrorCorrection.M): QrMatrix

Encodes data as a QR Code at the given errorCorrection level.

The smallest version (1–40) whose byte-mode capacity fits the UTF-8 encoding of data at errorCorrection is selected automatically.

Throws

IllegalArgumentException

if data is too large to fit version 40 at the requested error-correction level.