0.9.9 • Published 6 years ago

nativescript-ichi-printer v0.9.9

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

nativescript-ichi-printer

POS printer for NativeScript.

Supported platforms

  • Android (any device with Android 4.4 and higher)

There is no support for iOS yet!

Installing

tns plugin add nativescript-ichi-printer

Usage

Here is a TypeScript example:

import {PrintClient} from "nativescript-ichi-printer";

// new Printer Client, param:  0: TCP, 1: USB, 2: Bluetooth
var printClient = new PrintClient(0);
printClient.onData = (data: Array<number>) => {
    console.log("Data from Printer: ", data);
};
printClient.onError = (id: number, message: string) => {
    console.log("Print client error for action #", id, ": ", message);
};
printClient.onConnected = (id: number) => {
    console.log("Print client connected action #: ", id);
    var message = "Print test String!";
    var bytes = [];
    for (var i = 0; i < message.length; i++) {
        var c = message.charCodeAt(i);
        bytes.push(c & 0xFF);
    }
    printClient.send(bytes);
};
printClient.onSent = (id: number) => {
    console.log("Print client sent action #: ", id);
    // When we are finished
    printClient.close();
};
printClient.onClosed = (id: number) => {
    console.log("Print client closed action #: ", id);
};

// Connect printer (type: TCP), param: IP, port
printClient.connect("192.168.1.192", 9100);

// // Connect printer (type: USB), param: printer Name by getUsbPrinters()
// printClient.connect("USB Support Printer 1", 0);

// // Connect printer (type: Bluetooth), param: printer Name by getBlueToothPrinters()
// printClient.connect("58 POS printer", 0);
0.9.9

6 years ago

0.9.7

6 years ago

0.9.6

6 years ago

0.9.5

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago