Appcelerator Titanium library that implements https://github.com/DantSu/ESCPOS-ThermalPrinter-Android to print with (Bluetooth, TCP, USB) ESC/POS thermal printer
<module>ti.thermalprinter</module>
in tiapp.xml- add this to your build.gradle:
repositories {
maven { url 'https://jitpack.io' }
}
const ThermalPrinter = require("ti.thermalprinter")
- TYPE_BLUETOOTH
- TYPE_TCP
- TYPE_USB
-
requestPermissions()
-
print({connection, text, [ip, port, timeout, dpi, width, cpl});
connection
: TYPE_BLUETOOTH | TYPE_TCP | TYPE_USBtext
: actual text. See https://github.com/DantSu/ESCPOS-ThermalPrinter-Android#formatted-text--syntax-guide for syntax
if
connection
isTYPE_TCP
you have to set:ip
(String),port
,dpi
,width
andcpl
(characters per line)
-
getUSBList()
prints a list of connected USB devices to the console. Only for debug at the moment -
scanPrinters()
prints a list of BLE devices to the console. Only for debug at the moment
const ThermalPrinter = require("ti.thermalprinter");
ThermalPrinter.print({
connection: ThermalPrinter.TYPE_BLUETOOTH,
text: "[C]================================\n" +
"[L]\n" +
"[L]<font size='tall'>Customer :</font>\n" +
"[L]User name\n" +
"[L]Street No 7\n" +
"[L]1234 place\n" +
"[L]Tel : +123456\n" +
"[L]\n" +
"[C]<qrcode size='20'>http://www.migaweb.de/</qrcode>"
});
- add support for images
- add "getList" to select a different printer. Currently it will use the first one
- Michael Gangolf (@MichaelGangolf / Web)