Context: Working on a sales app developped using angular, typescript and electron, I was assigned to open the cash drawer conected to an Epson TM-T20II Thermal printer but I am having trouble using and understanding the epson ePOS SDK correctly. Here is the code for now and i will edit it as i go further: ePosDev = new epson.ePOSDevice(); printer: any = null; ngOnInit(){ //runs on page load this.connectToPrinter(); if (this.printer){ athis.openDrawer(); } this.ePosDev.disconnect(); } connectToPrinter(){ //connects with the printer's ip according to the documentation this.ePosDev.connect("[printer ip]", 8008, (data: any) => { console.log("executed successfully"); this.createDevice(data); }); } createDevice(data: string){ //initiate the object according to the documentation if (data == 'OK' || data == 'SSL_CONNECT_OK') { this.ePosDev.createDevice('local_printer', this.ePosDev.DEVICE_TYPE_PRINTER, { 'crypto': false, 'buffer': false }, (devobj: any, retcode: any) => {this.configPrinter(devobj, retcode)}); } else { console.log(data); } } configPrinter(devobj: any, retcode: string){ //sets the printer variable and timeout if (retcode == 'OK') { this.printer = devobj; this.printer.timeout = 60000; }else{ console.log(retcode); } } openDrawer(){//add the drawer oppening command to the buffer and sends it to the printer this.printer.addPulse(this.printer.DRAWER_1, this.printer.PULSE_100); this.printer.send(); } (The code was synthesized to keep only usefull informations, the angular component was implemented correclty and the page works as intended apart from this specific part) Now what's going wrong? : On page load, it seems that the callback of the connection to the printer doesn't execute itself. only thing happening is that my printer prints a receipt with information. Also, I realised while asking this question that if I remove the if statement around the openDrawer() call, the callback is executed but an error occurs in openDrawer before the console.log is executed. It's getting pretty confusing to me so if any of you have any idea on what I am doing wrong I will be very grateful for your feedback There isn't a lot of tutorials or articles about the api so here is the documentation's link and any link i will find usefull while i keep looking for solutions: -official documentation: https://download4.epson.biz/sec_pubs/pos/reference_en/epos_js/index.html Continue reading...