Callback that writes a raw Buffer to the printer.
Typically (data) => this._raw(data) from an Escpos subclass.
Active printer profile; used to resolve the available code pages via PrinterProfile.getCodePages.
Lock all subsequent output to a specific code page, bypassing auto-detection.
Pass false to return to auto-detection mode.
Canonical encoding name (e.g. "CP437") to force, or
false to re-enable automatic encoding selection.
Encode and write a UTF-8 string to the printer.
In auto mode, the string is scanned character by character. ASCII
characters are buffered as-is. For non-ASCII characters, the method
searches the profile's available code pages for one that can represent
the character, emitting a code-page switch (ESC t n) if needed.
In forced mode (forceEncoding was called with a string), the entire string is encoded with that encoding.
UTF-8 string to encode and send.
Automatic multi-encoding text encoder.
Wraps a raw-bytes write function and a PrinterProfile to produce correctly encoded ESC/POS byte streams for arbitrary Unicode text.
Auto mode (default): Characters are grouped by the first code page in the active printer profile that can represent them. A
ESC t nswitch command is emitted whenever the required code page changes. ASCII characters (< 128) are always emitted as-is without a code-page switch.Forced mode: Call forceEncoding to lock all output to a specific code page. Useful when the printer profile and document encoding are both known in advance.
Example
Since
1.0.0