export { generatePdf } from './images/pdf'; export { generatePng } from './images/png'; export { generateSvg, generateSvgPath } from './images/svg'; /** * The error correction level for QR codes (`L`, `M`, `Q`, or `H`) * * * `L`: approximately 7% of error correction capability * * `M`: approximately 15% of error correction capability * * `Q`: approximately 25% of error correction capability * * `H`: approximately 30% of error correction capability */ export type ECLevel = 'L' | 'M' | 'Q' | 'H'; /** The structure of a _generated_ QR code */ export interface QrCode { /** The version of the QR code (1...40) */ readonly version: number; /** The error correction level for the QR code */ readonly ecLevel: ECLevel; /** The size (in pixels) of the QR code */ readonly size: number; /** The QR code matrix */ readonly matrix: readonly boolean[][]; } /** Options for the generation of a {@link QrCode} */ export interface QrCodeGenerationOptions { /** The error correction level for the QR code (default: `M`) */ ecLevel?: ECLevel; /** Whether to optimize URLs in QR codes (default: `false`) */ url?: boolean; } /** Options to render a {@link QrCode} into an image */ export interface QrCodeImageOptions { /** * The number of pixels used for each dot in the matrix * (default: `1` for PNG/SVG and `9` for PDF) */ scale?: number; /** * The size of the margin around the QR code in matrix modules * (default: `4` as per the QR code specification - the _quiet area_) */ margin?: number; } /** QR code options */ export interface QrCodeOptions extends QrCodeGenerationOptions, QrCodeImageOptions { } /** Generate a {@link QrCode} from a string or binary message */ export declare function generateQrCode(message: string | Uint8Array, options?: QrCodeGenerationOptions): QrCode; /** Generate a QR code in PNG format from a string or binary message */ export declare function generatePngQrCode(message: string | Uint8Array, options?: QrCodeOptions): Promise; /** Generate a QR code in PDF format from a string or binary message */ export declare function generatePdfQrCode(message: string | Uint8Array, options?: QrCodeOptions): Promise; /** Generate a QR code in SVG format from a string or binary message */ export declare function generateSvgQrCode(message: string | Uint8Array, options?: QrCodeOptions): string; /** Generate a QR code as a PNG data URL from a string or binary message */ export declare function generatePngDataQrCode(message: string | Uint8Array, options?: QrCodeOptions): Promise; /** Generate a QR code as a PDF data URL from a string or binary message */ export declare function generatePdfDataQrCode(message: string | Uint8Array, options?: QrCodeOptions): Promise; /** Generate a QR code as a SVG data URL from a string or binary message */ export declare function generateSvgDataQrCode(message: string | Uint8Array, options?: QrCodeOptions): string; /** Generate a QR code in PNG format from a string or binary message */ export declare function generate(message: string | Uint8Array, format: 'png', options?: QrCodeOptions): Promise; /** Generate a QR code in PDF format from a string or binary message */ export declare function generate(message: string | Uint8Array, format: 'pdf', options?: QrCodeOptions): Promise; /** Generate a QR code in SVG format from a string or binary message */ export declare function generate(message: string | Uint8Array, format: 'svg', options?: QrCodeOptions): Promise; /** Generate a QR code as a PNG data URL from a string or binary message */ export declare function generate(message: string | Uint8Array, format: 'pngData', options?: QrCodeOptions): Promise; /** Generate a QR code as a PDF data URL from a string or binary message */ export declare function generate(message: string | Uint8Array, format: 'pdfData', options?: QrCodeOptions): Promise; /** Generate a QR code as a SVG data URL from a string or binary message */ export declare function generate(message: string | Uint8Array, format: 'svgData', options?: QrCodeOptions): Promise; /** Generate a QR code as an image */ export declare function generate(message: string | Uint8Array, format: Format, options?: QrCodeOptions): Promise;