Kaizen
Browse modulesQR codeqr-code/sharedFunctions

Function: encodeQrCode()

function encodeQrCode(value: string, options?: {
  errorCorrectionLevel?: "L" | "M" | "Q" | "H";
  quietZone?: number;
}): QrCodeMatrix;

Defined in: shared/qr-code/encode.ts:39

Encode value into a QR symbol.

Isomorphic: no DOM, no canvas, no Node built-ins — safe to call from a browser bundle, a report renderer, or a receipt-printer job.

Parameters

ParameterTypeDescription
valuestring-
options{ errorCorrectionLevel?: "L" | "M" | "Q" | "H"; quietZone?: number; }-
options.errorCorrectionLevel?"L" | "M" | "Q" | "H"See qrCodeErrorCorrectionLevelSchema.
options.quietZone?numberLight margin in modules on every side. Fixed at the spec minimum by default; there is no reason to go lower, because a caller whose layout already supplies white space loses nothing by keeping the symbol's own quiet zone.

Returns

QrCodeMatrix

Throws

invalid_value for an empty or oversized payload, invalid_options for bad options, capacity_exceeded when the payload doesn't fit at the requested error-correction level.

On this page