qrCode

fun qrCode(data: String, size: Dp = Dp(100f), errorCorrection: QrErrorCorrection = QrErrorCorrection.M, color: PdfColor = PdfColor.Black, background: PdfColor? = PdfColor.White)

Appends a QR code symbol encoding data in byte mode (UTF-8). The symbol is drawn as crisp vector squares, so it scans reliably at any print size, and the smallest QR version that fits the payload at the requested errorCorrection level is selected automatically.

Leave some quiet space around the symbol (the QR spec recommends 4 modules) — a padded container or the page margin is usually enough.

Parameters

data

payload — URLs, plain text, vCards, etc.

size

rendered edge length of the (square) symbol.

errorCorrection

redundancy level; higher levels survive more damage but produce denser symbols.

color

module (dark square) colour.

background

fill behind the symbol; null for transparent. Keep strong contrast against color or scanners will struggle.