///
export declare type BarCodeSymbology = 'UPC' | 'UPCE' | 'EAN13' | 'EAN8' | 'CODE39' | 'ITF' | 'codabar' | 'CODE128';
export declare type Codepage = 'cp437' | 'cp720' | 'cp737' | 'cp775' | 'cp850' | 'cp851' | 'cp852' | 'cp853' | 'cp855' | 'cp857' | 'cp858' | 'cp860' | 'cp861' | 'cp862' | 'cp863' | 'cp864' | 'cp865' | 'cp866' | 'cp869' | 'cp874' | 'cp1098' | 'cp1118' | 'cp1119' | 'cp1125' | 'cp1162' | 'cp2001' | 'cp3001' | 'cp3002' | 'cp3011' | 'cp3012' | 'cp3021' | 'cp3041' | 'cp3840' | 'cp3841' | 'cp3843' | 'cp3844' | 'cp3845' | 'cp3846' | 'cp3847' | 'cp3848' | 'iso88591' | 'iso88592' | 'iso88597' | 'iso885915' | 'rk1048' | 'windows1250' | 'windows1251' | 'windows1252' | 'windows1253' | 'windows1254' | 'windows1255' | 'windows1256' | 'windows1257' | 'windows1258';
export declare type Printer = 'epson' | 'zjiang' | 'bixolon' | 'star' | 'legacy';
export declare const codepageMappings: Record>;
export interface EscPosOptions {
width: number | null;
embedded: boolean;
wordWrap: boolean;
defaultLFHeight: number;
imageMode: 'column' | 'raster';
codepageMapping: Printer;
codepageCandidates: Codepage[];
}
export interface EscPosState {
codepage: number;
align: 'left' | 'right' | 'center';
bold: boolean;
italic: boolean;
underline: boolean | number;
invert: boolean;
width: number;
height: number;
size: 'normal' | 'small';
}
export declare type EscPosEncoderType = typeof EscPosEncoder;
export default class EscPosEncoder {
protected _options: EscPosOptions;
protected _state: EscPosState;
protected _embedded: boolean;
protected _buffer: (number | number[] | Buffer | Uint8Array)[];
protected _queued: (number | number[] | Buffer | Uint8Array)[];
protected _cursor: number;
protected _codepage: Codepage | 'auto' | 'ascii';
protected _maxLineLength: number;
/**
* Create a new object
*
* @param {object} options Object containing configuration options
*/
constructor(options?: Partial);
/**
* Reset the state of the object
*
* @param {object} options Object containing configuration options
*/
protected _reset(options?: Partial): void;
/**
* Encode a string with the current code page
*
* @param value String to encode
* @return Encoded string as a ArrayBuffer
*
*/
protected _encode(value: string): Uint8Array;
/**
* Add commands to the queue
*
* @param {array} value Add array of numbers, arrays, buffers or Uint8Arrays to add to the buffer
*
*/
protected _queue(value: (number | Buffer | Uint8Array | Array)[]): void;
/**
* Flush current queue to buffer
*/
protected _flush(): void;
/**
* Wrap the text while respecting the position of the cursor
*
* @param value String to wrap after the width of the paper has been reached
* @param position Position on which to force a wrap
* @return Array with each line
*/
protected _wrap(value: string, position: number): string[];
/**
* Restore styles and codepages after drawing boxes or lines
*/
protected _restoreState(): void;
/**
* Get code page identifier for the specified code page and mapping
*
* @param codepage Required code page
* @return Identifier for the current printer according to the specified mapping
*/
protected _getCodepageIdentifier(codepage: Codepage): number;
/**
* Initialize the printer
*
* @return Return self, for easy chaining commands
*/
initialize(): this;
/**
* Change the code page
*
* @param codepage The codepage that we set the printer to
* @return Return self, for easy chaining commands
*
*/
codepage(codepage: Codepage | 'auto' | 'ascii'): this;
/**
* Print text
*
* @param value Text that needs to be printed
* @param wrap Wrap text after this many positions
* @return Return self, for easy chaining commands
*
*/
text(value: string, wrap?: number): this;
/**
* Print a newline
*
* @param size Size 0 - 255
* @return Return self, for easy chaining commands
*/
newline(size?: number): this;
/**
* Print text, followed by a newline
*
* @param {string} value Text that needs to be printed
* @param {number} wrap Wrap text after this many positions
* @return {object} Return self, for easy chaining commands
*
*/
line(value: string, wrap?: number): this;
/**
* Print an array of lines
*
* @param value Text that needs to be printed
* @return Return self, for easy chaining commands
*/
lines(value: string[]): this;
/**
* Print a key and a value with spaces or dots filling in between
*
* @param key Left item
* @param value Right item
* @param style Style of the spaces in between
* @returns Return self, for easy chaining commands
*/
keyvalue(key: string, value: string, style?: 'dots' | 'spaces'): this;
/**
* Underline text
*
* @param {boolean|number} value `true` to turn on underline, `false` to turn off, or 2 for double underline
* @return Return self, for easy chaining commands
*
*/
underline(value: boolean | number): this;
/**
* Italic text
*
* @param value `true` to turn on italic, `false` to turn off
* @return Return self, for easy chaining commands
*/
italic(value?: boolean): this;
/**
* Bold text
*
* @param value `true` to turn on bold, `false` to turn off
* @return Return self, for easy chaining commands
*/
bold(value?: boolean): this;
/**
* Change width of text
*
* @param width The width of the text, 1 - 3
* @return Return self, for easy chaining commands
*/
width(width?: number): this;
/**
* Change height of text
*
* @param height The height of the text, 1 - 3
* @return Return self, for easy chaining commands
*/
height(height?: number): this;
/**
* Invert text
*
* @param value `true` to turn on white text on black, `false` to turn off
* @return Return self, for easy chaining commands
*/
invert(value?: boolean): this;
/**
* Change text size
*
* @param value `'small'` or `'normal'`
* @return Return self, for easy chaining commands
*/
size(value: 'small' | 'normal'): this;
/**
* Change text alignment
*
* @param value `'left'`, `'center'` or `'right'`, defaults to 'left'
* @return Return self, for easy chaining commands
*/
align(value: 'left' | 'center' | 'right'): this;
/**
* Insert a horizontal rule
*
* @param width Defaults to max line length
* @return Return self, for easy chaining commands
*/
rule(width?: number): this;
/**
* Barcode
*
* @param value Barcode contents
* @param symbology Barcode type
* @param height Barcode height, defaults to `10`
* @return Return self, for easy chaining commands
*/
barcode(value: string, symbology: BarCodeSymbology, height: number): this;
/**
* QR Code
*
* @param value QR Code contents
* @param _ Model of the qrcode, either `1` or `2`
* @param size Size of the qrcode, a value between `1` and `8`, defaults to `6`
* @param errorlevel The amount of error correction used, either `'l'`, `'m'`, `'q'` or `'h'`
* @return Return self, for easy chaining commands
*/
qrcode(value: string, model?: 1 | 2, size?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8, errorlevel?: 'L' | 'M' | 'Q' | 'H'): this;
/**
* Prints image, supports PNG and JPEG
*
* @param base64 png base64
* @param algorithm The dithering algorithm for making the image black and white
* @param threshold Threshold for the dithering algorithm
* @return Return self, for easy chaining commands
*/
image(base64: string, algorithm?: 'threshold' | 'bayer' | 'floydsteinberg' | 'atkinson', threshold?: number): this;
/**
* Cut paper
*
* @param value Full or partial. When not specified a full cut will be assumed
* @return Return self, for easy chaining commands
*
*/
cut(value: 'full' | 'partial'): this;
/**
* Pulse
*
* @param {number} device 0 or 1 for on which pin the device is connected, default of 0
* @param {number} on Time the pulse is on in milliseconds, default of 100
* @param {number} off Time the pulse is off in milliseconds, default of 500
* @return Return self, for easy chaining commands
*
*/
pulse(device?: 0 | 1, on?: number, off?: number): this;
/**
* Add raw printer commands
*
* @param {array} data raw bytes to be included
* @return {object} Return self, for easy chaining commands
*
*/
raw(data: (number | any[] | Uint8Array | Buffer)[]): this;
/**
* Encode all previous commands
*
* @return {Uint8Array} Return the encoded bytes
*
*/
encode(): Uint8Array;
}