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

[FEAT]: how to get printer list #437

Open
Boolean2023 opened this issue Oct 10, 2024 · 4 comments
Open

[FEAT]: how to get printer list #437

Boolean2023 opened this issue Oct 10, 2024 · 4 comments

Comments

@Boolean2023
Copy link

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

@Psychopoulet
Copy link
Collaborator

Psychopoulet commented Oct 15, 2024

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;
});

});
``

@tamil752002
Copy link

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

@Psychopoulet
Copy link
Collaborator

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

@Boolean2023
Copy link
Author

OK Thanks

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

No branches or pull requests

3 participants