View as Markdown

API reference: @salmonui/charts/barcode

BarcodeApiinterface

import type { BarcodeApi } from '@salmonui/charts/barcode';

Also exported from @salmonui/charts/barcode/pdf417, @salmonui/charts/barcode/gs1-databar, @salmonui/charts/barcode/dotcode.

interface BarcodeApi {
    readonly element: SVGSVGElement | null;
    toSVGString(): string;
    toBlob(format?: BarcodeImageFormat, options?: Omit<BarcodeExportOptions, 'format' | 'fileName'>): Promise<Blob>;
    toDataURL(format?: BarcodeImageFormat, options?: Omit<BarcodeExportOptions, 'format' | 'fileName'>): Promise<string>;
    export(options?: BarcodeExportOptions): Promise<void>;
}

Instance reached through ref on Barcode and QRCode.

BarcodeApi members (5)
NameSignatureDescription
elementreadonly element: SVGSVGElement | null;

The root <svg> (null before mount).

toSVGStringtoSVGString(): string;

Standalone SVG markup; works without a DOM (server, tests).

toBlobtoBlob(format?: BarcodeImageFormat, options?: Omit<BarcodeExportOptions, 'format' | 'fileName'>): Promise<Blob>;
toDataURLtoDataURL(format?: BarcodeImageFormat, options?: Omit<BarcodeExportOptions, 'format' | 'fileName'>): Promise<string>;
exportexport(options?: BarcodeExportOptions): Promise<void>;

Downloads the symbol; settles after the download started.