class EposXml.EposText
extends XMLElement

A <text> element. Formatting carries through to the next text elements.

Constructors

new
EposText(content?: string)

Properties

writeonly
alignment: EposAlign | undefined
writeonly
font: EposFont | undefined
writeonly
raw: boolean
readonly
raw: boolean

Whether to use "raw" mode when encoding text.

Ensures, at the cost of size, that every character is pedantically escaped. Useful for guaranteeing a parser will always get the expected value back out.

rawOptions: { width: number | undefined; height: number | undefined; smooth: boolean | undefined; align: EposAlign | undefined; font: EposFont | undefined; }
writeonly
size: { width?: number; height?: number; }
writeonly
smooth: boolean | undefined
writeonly
text: string | undefined
readonly
alignment: EposAlign | undefined
readonly
font: EposFont | undefined
readonly
size: { width?: number; height?: number; }
readonly
smooth: boolean | undefined
readonly
text: string | undefined
private
abstract
xmlTextChild: XMLText
private
xmlTextChildIsBinary: boolean

Methods

clearText(): this

Clears this.text, but preserves formatting options.

hardReset(): this

Due to ePOS Formatting carrying through to future elements in the sequence, this provides every option that EposText has as a sensible default, trying to stay close to the printer's defaults.

setAlignment(alignment: EposAlign | undefined): this

Sets the alignment of this text.

setFont(font: EposFont | undefined): this

Sets the font of this text.

setSize(
w?: number,
h?: number,
): this

Sets the size, as integer multiples, of each character. Printer defaults to (1,1).

setSmooth(value?: boolean): this

Sets whether the printer should smooth the edges of this text.

setText(text: string): this

Wrapper around setting this.text

setTextLn(text: string): this

Similar to the println equivalent of printf, this simply wraps this.setText and adds a trailing newline.

toString(): string

Static Methods

Creates a blank new hardReset-formatted EposText