import { ConfigurationChunk, chunkOptions, image, line, imageOptions } from '../tools/formatters'; import { PrinterLanguage, LineSegment, PrinterImageBase } from './base-printer-language'; import * as utils from '../tools/utils'; import * as formatters2 from '../tools/formatters'; /** * This class is used to convert images to a format that can be printed by zebra printers. */ export declare class ZplImage { private rawData; private width; private height; private monochrome; private normal; private invert; private left; private right; private u8tob64; private crc16; private discoverMapping; private compressToZpl; private rgbaToZ64; constructor(rawData: any, width: any, height: any); /** * * @returns {string} an object containing the image data in both Z64 and hexadecimal formats, as well additional information about the image */ toZpl(): PrinterImageBase; } /** * This class implements the ZPL printer language used by Zebra printers. * @remarks When using ZPL, the default character to specify a printer command is the caret (**^**) character. * If the text begins with a caret, it is considered a ZPL command and it is executed as is. */ export declare class ZebraZPLPrinterLanguage extends PrinterLanguage { constructor(); /** @ignore */ protected lines: Array; /** Can be used to increase the document height if necessary */ /** * Changes the current coordinates of the printer for printing the next line * @param xCoord - The new X coordinate (used for left/right alignment) * @param zCoord - The new Z coordinate (used for up/down alignment) */ updateCoordinates(xCoord?: number, zCoord?: number): void; /** Used to track the current Z coordinate of the receipt. This is later * used to calculate the total document height */ protected currentCoord: number; /** * Retrieves the current coordinates of the printer * @returns {xCoord: number, zCoord: number} The current coordinates of the printer */ protected getCurentCoordinates(): { xCoord: number; zCoord: number; }; /** * Changes the current coordinates of the printer for printing the next line * @deprecated use {@link updateCoordinates} instead * @param xCoord - The new X coordinate (used for left/right alignment) * @param zCoord - The new Z coordinate (used for up/down alignment) */ private setCoordinates; /** * This method can be used to change the default configuration of the printer * @param fontHeight - The new font height in dots. How this is handled on ZPL printer depends on the font. * Refer to printer documentation for additional information. * @param fontWidth - The new font width in dots. How this is handled on ZPL printer depends on the font. * Refer to printer documentation for additional information. * @param lineSpacing - The new line spacing in dots. * @param font - The new font to use. For ZPL printers the font name is usually 1 character (A, B, C, ... ). * Refer to printer documentation for a list of available fonts. */ changeDefaultConfiguration(fontHeight?: number, fontWidth?: number, lineSpacing?: number, font?: string): void; /** * Used to print a horizontal ruler on the paper * @param ruler - The character to use for the ruler */ printHorizRuler(ruler: string): void; /** * Used to print QR code. This method performs automatic unescaping of the equals sign (=) in the qr code content. * @param qrContent - The content of the qr code to print */ printQrCode(qrContent: string): void; /** * Used to print a barcode on the paper using ZPL commands * @param barcodeData - The data to encode in the barcode * @param barcodeType - The type of barcode to print (from utils.Barcode enum) * @param height - The height of the barcode in dots (default: 50) * @param width - The width multiplier for barcode bars (default: 2) * @param offset - The horizontal offset for barcode positioning * @param alignment - How the barcode should be aligned on the paper (default: Left) * @param options - Additional barcode options including ^BY command parameters */ printBarcode(barcodeData: string, barcodeType: utils.Barcode, height: number, width: number, offset: number, alignment: utils.Alignment, options?: formatters2.barcodeOptions): void; /** * Used to print a text line on the paper. If the text begins with ^ it is considered a ZPL command and it executed as is. * The ZPL command will not be considered when calculating the new coordinates for the next print command * @param line - An array of LineSegment objects. Each LineSegment object contains the text to print and the style to use. */ printLine(line: Array): void; private generateStrikeThroughLine; /** * Use this to begin printing a new document. * @returns {string} the document to print in zpl format */ printDocument(): string; printDocumentAsync(): Promise; /** * Use to print an image on the paper * @param imageData - Contains the image data in a format that can be printed by zebra printers (Uint8Array or base64 string) * @param width - The width of the image in dots * @param height - The width of the image in dots * @param alignment - How the image is aligned on the paper */ printImage(imageData: any, width: number, height: number, alignment: utils.Alignment, options: imageOptions): Promise; /** * Default constructor for the ZebraZPLPrinterLanguage class * @param config - The configuration to use for the printer */ init(config: any): void; /** * Can be used to change the current configuration of the printer */ changeConfiguration(chunk: ConfigurationChunk): void; /** * Converts base64 image data to RGBA Uint8Array for ZPL processing * @param imageData - The image data, can be base64 string, data URL, or Uint8Array * @param width - The expected width of the image * @param height - The expected height of the image * @returns Promise RGBA representation of the image data */ private convertImageDataToRGBA; /** * Decodes base64 image data to RGBA using canvas * @param base64Data - Base64 encoded image data * @param expectedWidth - Expected width (for validation) * @param expectedHeight - Expected height (for validation) * @returns Promise RGBA pixel data */ private decodeImageFromBase64; /** * Can be used to specify how a word is printed. This is useful for printing text containing special characters (arabic, french, etc.) * @param word - The word to be printed * @param options - Options for controlling how the word is printed * @returns - The text to print. If the language is arabic, this word is prepended * with the left to right mark character */ renderWord(word: string, options: chunkOptions): string; printImageRow(images: Array, width: number, height: number, alignment: utils.Alignment, options?: imageOptions): Promise; }