dataMatrix

fun dataMatrix(data: String, size: Dp = Dp(100f), color: PdfColor = PdfColor.Black, background: PdfColor? = PdfColor.White)

Appends a Data Matrix (ECC 200) 2D barcode encoding data.

Encoding (ASCII encodation, Reed-Solomon error correction, the smallest fitting square symbol from 10×10 to 52×52) happens in common code via com.conamobile.pdfkmp.barcode.DataMatrixEncoder. Bytes above 127 are rejected at build time.

Like QR, Data Matrix expects a small quiet zone — place it inside a padded container or against the page margin.

Parameters

data

payload; ASCII bytes 0..127 only. Larger / non-ASCII input throws IllegalArgumentException.

size

rendered edge length (square).

color

module (dark square) colour.

background

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