An open API service indexing awesome lists of open source software.

https://github.com/m1ga/ti.thermalprinter

ESC/POS thermal printer library for Titanium (Android)
https://github.com/m1ga/ti.thermalprinter

android mobile titanium-mobile titanium-module

Last synced: 9 months ago
JSON representation

ESC/POS thermal printer library for Titanium (Android)

Awesome Lists containing this project

README

          

# 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

* `ti.thermalprinter` 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});`
* `connection`: TYPE_BLUETOOTH | TYPE_TCP | TYPE_USB
* `text`: actual text. See https://github.com/DantSu/ESCPOS-ThermalPrinter-Android#formatted-text--syntax-guide for syntax

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

```js
const ThermalPrinter = require("ti.thermalprinter");
ThermalPrinter.print({
connection: ThermalPrinter.TYPE_BLUETOOTH,
text: "[C]================================\n" +
"[L]\n" +
"[L]Customer :\n" +
"[L]User name\n" +
"[L]Street No 7\n" +
"[L]1234 place\n" +
"[L]Tel : +123456\n" +
"[L]\n" +
"[C]http://www.migaweb.de/"
});
```

## TODO

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

## Author

* Michael Gangolf (@MichaelGangolf / Web)

Buy Me A Coke donate button