Skip to content

ESC/POS thermal printer library for Titanium (Android)

License

Notifications You must be signed in to change notification settings

m1ga/ti.thermalprinter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ti.Thermalprinter - ESC/POS thermal printer library for Titanium (Android)

Appcelerator Titanium library that implements https://github.com/DantSu/ESCPOS-ThermalPrinter-Android to print with (Bluetooth, TCP, USB) ESC/POS thermal printer

Installation

  • <module>ti.thermalprinter</module> in tiapp.xml
  • add this to your build.gradle:
repositories {
    maven { url 'https://jitpack.io' }
}
  • const ThermalPrinter = require("ti.thermalprinter")

Constants

  • TYPE_BLUETOOTH
  • TYPE_TCP
  • TYPE_USB

Methods

  • requestPermissions()

  • print({connection, text, [ip, port, timeout, dpi, width, cpl});

    if connection is TYPE_TCP you have to set:

    • ip (String), port, dpi, width and cpl (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

Example

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>"
});

TODO

  • add support for images
  • add "getList" to select a different printer. Currently it will use the first one

Author

Buy Me A Coke donate button

About

ESC/POS thermal printer library for Titanium (Android)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages