Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STAR TSP100 #235

Open
jayel74 opened this issue Sep 27, 2023 · 5 comments
Open

STAR TSP100 #235

jayel74 opened this issue Sep 27, 2023 · 5 comments

Comments

@jayel74
Copy link

jayel74 commented Sep 27, 2023

Hey,

Great library, but we cannot seem to print anything to a TSP 100 STAR printer.
Is does say the data is sended to the printer, but nothing is printed.

const ThermalPrinter = require("node-thermal-printer").printer;
const PrinterTypes = require("node-thermal-printer").types;



async function testConnection() {
    const printer = new ThermalPrinter({
        type: PrinterTypes.STAR,
        interface: "tcp://192.168.18.118",
    });

    printer.alignCenter();
    printer.println("Hello world");
    //await printer.printImage('./assets/olaii-logo-black.png')
    printer.cut();

    try {
        let execute = printer.execute()
        console.log("Print done!");
    } catch (error) {
        console.error("Print failed:", error);
    }
}

PS D:\development\node\testposprinter> node index.js Print done! Data sent to printer: 192.168.18.118:9100 <Buffer 1b 74 12 1b 61 01 48 65 6c 6c 6f 20 77 6f 72 6c 64 0a 1b 64 04 1b 64 04 1d 56 00 1b 40> PS D:\development\node\testposprinter> node index.js Print done! Data sent to printer: 192.168.18.118:9100 <Buffer 1b 74 12 1b 1d 61 01 48 65 6c 6c 6f 20 77 6f 72 6c 64 0a 0b 0b 1b 64 02 1b 40>

Any pointers?

greets
John

@Klemen1337
Copy link
Owner

Hi @jayel74 try adding port to your netowrk string. For example "tcp://192.168.18.118:9100"

@jayel74
Copy link
Author

jayel74 commented Oct 2, 2023

Hey @Klemen1337, i've added 9100, but no go.
Nothing is printed !

PS D:\development\node\testposprinter> node index.js                                                                  
Print done!
Data sent to printer: 192.168.18.118:9100 <Buffer 1b 74 12 1b 1d 61 01 48 65 6c 6c 6f 20 77 6f 72 6c 64 0a 0b 0b 1b 64 02 1b 40>
PS D:\development\node\testposprinter>

async function testConnection() {
    const printer = new ThermalPrinter({
        type: PrinterTypes.STAR,
        interface: "tcp://192.168.18.118:9100",
    });

    printer.alignCenter();
    printer.println("Hello world");
    //await printer.printImage('./assets/olaii-logo-black.png')
    printer.cut();

    try {
        let execute = printer.execute()
        console.log("Print done!");
    } catch (error) {
        console.error("Print failed:", error);
    }
}

@Klemen1337
Copy link
Owner

Can you add await to execute function? Can you also print the printer config? power on + feed button should print default config. You can check IP and port there.

let execute = await printer.execute()

@jayel74
Copy link
Author

jayel74 commented Oct 2, 2023

async function testConnection() {
    const printer = new ThermalPrinter({
        type: PrinterTypes.STAR,
        interface: "tcp://192.168.18.118:9100",
    });

    printer.alignCenter();
    printer.println("Hello world");
    //await printer.printImage('./assets/olaii-logo-black.png')
    printer.cut();

    try {
        let execute = await printer.execute()
        console.log("Print done!");
    } catch (error) {
        console.error("Print failed:", error);
    }
}

testConnection();
PS D:\development\node\testposprinter> node index.js
Data sent to printer: 192.168.18.118:9100 <Buffer 1b 74 12 1b 1d 61 01 48 65 6c 6c 6f 20 77 6f 72 6c 64 0a 0b 0b 1b 64 02 1b 40>
PS D:\development\node\testposprinter> 

But no ticket !
image

@jayel74
Copy link
Author

jayel74 commented Oct 15, 2023

hello,

No update on the above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants