import { IPrinterDriver, IQrOptions } from '../types'; import { ICommandBuilder } from './interfaces'; import { TextAlign, TextStyle } from '../formatter'; import { BarcodeOptions } from '../barcode'; /** * Command Builder implementation */ export declare class CommandBuilder implements ICommandBuilder { private driver; private buffer; private _cachedBuffer; private readonly logger; private readonly formatter; private readonly barcodeGenerator; /** * Creates a new CommandBuilder instance * * @param driver - Printer driver instance */ constructor(driver?: IPrinterDriver); /** * Invalidates the cached combined buffer. * Must be called whenever the internal buffer array is modified. */ private invalidateCache; /** * Adds text to the print queue * * @param content - Text content * @param encoding - Text encoding * @returns this - For method chaining */ text(content: string, encoding?: string): this; /** * Adds line feeds to the print queue * * @param lines - Number of lines to feed * @returns this - For method chaining */ feed(lines?: number): this; /** * Adds a paper cut command to the print queue * * @returns this - For method chaining */ cut(): this; /** * Adds an image to the print queue * * @param data - Image data as Uint8Array * @param width - Image width * @param height - Image height * @returns this - For method chaining */ image(data: Uint8Array, width: number, height: number): this; /** * Adds a QR code to the print queue * * @param content - QR code content * @param options - QR code options * @returns this - For method chaining */ qr(content: string, options?: IQrOptions): this; /** * Clears the print queue * * @returns this - For method chaining */ clear(): this; /** * Sets text alignment * * @param alignment - Text alignment (left, center, right) * @returns this - For method chaining * * @example * ```typescript * builder.align(TextAlign.CENTER).text('Centered Text'); * ``` */ align(alignment: TextAlign): this; /** * Sets character size (width and height scale) * * @param width - Width scale factor (1-8) * @param height - Height scale factor (1-8) * @returns this - For method chaining * * @example * ```typescript * builder.setSize(2, 2).text('Double Size'); * ``` */ setSize(width: number, height: number): this; /** * Sets bold text mode * * @param enabled - Enable or disable bold * @returns this - For method chaining * * @example * ```typescript * builder.setBold(true).text('Bold Text').setBold(false); * ``` */ setBold(enabled: boolean): this; /** * Sets underline text mode * * @param enabled - Enable or disable underline * @returns this - For method chaining * * @example * ```typescript * builder.setUnderline(true).text('Underlined').setUnderline(false); * ``` */ setUnderline(enabled: boolean): this; /** * Sets inverse printing mode (white on black) * * @param enabled - Enable or disable inverse * @returns this - For method chaining * * @example * ```typescript * builder.setInverse(true).text('Inverse Text').setInverse(false); * ``` */ setInverse(enabled: boolean): this; /** * Sets multiple text style properties at once * * @param style - Text style configuration * @returns this - For method chaining * * @example * ```typescript * builder.setStyle({ align: TextAlign.CENTER, bold: true, heightScale: 2 }); * ``` */ setStyle(style: TextStyle): this; /** * Resets all text formatting to default * * @returns this - For method chaining * * @example * ```typescript * builder.resetStyle().text('Normal Text'); * ``` */ resetStyle(): this; /** * Adds a 1D barcode to the print queue * * @param content - Barcode content/data * @param options - Barcode options (format, height, width, showText, textPosition) * @returns this - For method chaining * * @example * ```typescript * builder.barcode('1234567890128', { * format: BarcodeFormat.EAN13, * height: 80, * showText: true * }); * ``` */ barcode(content: string, options: BarcodeOptions): this; /** * Gets the current buffer * * @returns Uint8Array - Current print buffer */ getBuffer(): Uint8Array; /** * Gets the total number of bytes in the buffer * * @returns number - Total bytes */ getTotalBytes(): number; }