 Anyone knows how to set-up a USB printer for node js. I m not able to configure the interface for it .
Here is my code
Anyone knows how to set-up a USB printer for node js. I m not able to configure the interface for it .
Here is my code
enter code here const ThermalPrinter = require("../node-thermal-printer").printer;
                const Types = require("../node-thermal-printer").types;
                const electron = typeof process !== 'undefined' && process.versions && 
                                  !!process.versions.electron;
                async function testConnection () { 
                let printer = new ThermalPrinter({
                type: 'star',                                    
                interface: "Gold" //name of the printer
                });
                printer.print("hi");
                let isConnected = await printer.isPrinterConnected() 
                console.log("Printer connected:", isConnected);
                }
                 testConnection();
The error that jumps out at me is in your interface. if you use a usb port I advise you to start by making a print sharing and then to configure your node-termal-printer file by modifying the value "interface"
first you do a printer sharing

you modify the value "interface" indicating the path and the shared printer
     `interface: '//localhost/printer',`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With