Skip to content

QRCode

Overview

Module

The QRCode class provides a static method for generating QR code images from text input. It utilizes the underlying native Java QRCodeFacade to perform the actual QR code generation, returning the resulting image as a byte array that can be easily used in JavaScript applications. This utility is particularly useful for applications that need to create QR codes for encoding URLs, contact information, or any other textual data in a compact visual format.

Key Features:

  • QR Code Generation: Converts input text into a QR code image represented as a byte array.
  • Easy Integration: The generated byte array can be easily integrated into web applications, allowing for dynamic QR code creation.

Use Cases:

  • Encoding URLs: Generate QR codes for URLs to facilitate quick access via mobile devices.
  • Contact Information: Create QR codes for vCards or other contact information formats.
  • Event Tickets: Generate QR codes for event tickets or other time-sensitive information.

Example Usage:

ts
import { QRCode } from "@aerokit/sdk/utils";

// Generate a QR code for a URL
const qrCodeBytes = QRCode.generateQRCode("https://www.example.com");
// The qrCodeBytes can now be used to create an image element or saved to a file

Classes

QRCode

generateQRCode()

Generates a QR code image byte array from the given text. The returned byte array represents the image data (e.g., PNG or JPEG format, depending on the native implementation's default output).

ts
static generateQRCode(text: string): void;
ParameterTypeDescription
textstringThe string content to be encoded in the QR code.

Returns

  • Type: void
  • Description: A JavaScript byte array (any[]) containing the raw QR code image data.