node-escpos icon indicating copy to clipboard operation
node-escpos copied to clipboard

[FEAT]: how to get printer list

Open Boolean2023 opened this issue 1 year ago • 5 comments

Description

is there a way to retrieve the list of printers paired on the machine with this package? if so, how do I get there?

Additional Information

Printers list node-escpos

Boolean2023 avatar Oct 10 '24 10:10 Boolean2023

with the embeded "usb" package, like this ?

`` usb.getDeviceList().filter((device) => { // has interfaces

return device && device.configDescriptor && device.configDescriptor.interfaces && device.configDescriptor.interfaces.length;

}).map((device) => { // formate

const interfaces = [];

device.configDescriptor.interfaces.forEach((its) => {

    its.forEach((it) => {

        interfaces.push({
            "id": it.bInterfaceNumber,
            "type": it.bInterfaceClass
        });

    });

});

return {
    "bus": device.busNumber,
    "port": device.deviceAddress,
    "vid": device.deviceDescriptor.idVendor,
    "pid": device.deviceDescriptor.idProduct,
    "interfaces": interfaces
};

}).filter((device) => { // only printers

return !!device.interfaces.find((it) => {
    return 7 === it.type;
});

}); ``

Psychopoulet avatar Oct 15 '24 14:10 Psychopoulet

can i get Printer List , which is Connect My Lan Network ? is this Possible

tamil752002 avatar Oct 23 '24 09:10 tamil752002

You may try to scan every IP on your network with an escpos ping and check which one is responding, I guess ?

Psychopoulet avatar Oct 24 '24 08:10 Psychopoulet

OK Thanks

Boolean2023 avatar Oct 25 '24 18:10 Boolean2023

estoy usando "escpos": "^3.0.0-alpha.6", "escpos-usb": "^3.0.0-alpha.4"

This works however in TypeScript this error apparently generates the USB interface awaits a string vine

Image

clopezpro avatar Apr 02 '25 13:04 clopezpro