paystory-de / thermal-printer-cordova-plugin

Cordova wrapper for ESC/POS Thermal Printer library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App Crash whenever i call print function

promisefemi opened this issue · comments

Hello, thanks for the library but i haven't been able to make it work, i am printing with TCP.
I pass all necessary fields, but it keeps crashing but if i take out the ID property from the data object, i doesn't crash but i get an error telling me to pass the ID but when i do the app crashes.

[App crash only happens when i call the function]

function requestPermission() { var IPAddress = "192.168.1.240"; var port = 9100; console.log(IPAddress, port); if (ThermalPrinter.printFormattedText) { ThermalPrinter.printFormattedTextAndCut( { type: "tcp", id: "192.168.1.240:9100", // i have also tried "192.168.1.2409100 address: IPAddress, port: port, }, function (success) { console.log(success, "SUCCESS"); }, function (error) { console.log(error, "ERROR"); } ); } }

Thanks.

Thanks for reporting.
Its fixed now in 1.0.6 -> fb9d8ff

Please use this command:

function requestPermission() {
    var IPAddress = "192.168.1.240";
    var port = 9100;
    console.log(IPAddress, port);
    if (ThermalPrinter.printFormattedText) {
        ThermalPrinter.printFormattedTextAndCut({
            type: "tcp",
            id: "192.168.1.240:9100", // ID can be also "myprinter" or "lan-printer" or something useful
            address: IPAddress,
            port: port,
            text: 'Its working now'
        }, function (success) {
            console.log(success, "SUCCESS");
        }, function (error) {
            console.log(error, "ERROR");
        });
    }
}