Skip to main content

constructor

Printer constructor​

Initializes the printer object.

[!NOTE] Implements singletone pattern. Return the same instance if the same target is passed.

Parameters​

target​

  • string

Specifies the method of connecting to the printer by a character string. The connection method varies according to the system configuration. Can be retrieved from the discovery.

I/FConnec-tion typeIdentifierExample
Wi-Fi/Ethernet"TCP"- IP address in IPv4 format
- MAC address
- Host name
"TCP:192.168.192.168"
Bluetooth"BT"BD address"BT:00:22:15:7D:70:9C"
USB"USB"- Device node
- USB Serial number
- Omitted
"USB:/dev/udev/*", "USB:00000000000000000", "USB:"

deviceName​

  • string

The name set to the device is stored.

Example: TM-T88V


lang​

  • enum PrinterModelLang

Specifies the language of the printer.

ValueDescription
PrinterConstants.MODEL_ANKANK model
PrinterConstants.MODEL_CHINESESimplified Chinese model
PrinterConstants.MODEL_TAIWANTaiwan model
PrinterConstants.MODEL_KOREANKorean model
PrinterConstants.MODEL_THAIThai model
PrinterConstants.MODEL_SOUTHASIASouth Asian model

Note: The default value is PrinterConstants.MODEL_ANK.

Example​

const printer = new Printer({
target: "BT:00:22:15:7D:70:9C",
deviceName: "TM-T88V",
})