问题
I'm developing an application with Node JS where I need to see all available printers in the user's machine, let the user select one of them and print a receipt.
Is there a way to achieve this in macOS and Windows ?
Note , I have checked all examples in internet,nothing helped. Kindly provide me an complete example.
回答1:
In googling there are few libraries that does this job...
Take a look on printer for example, it does all the jobs you require...
getPrinters()
to enumerate all installed printers with current jobs and statuses;
getPrinter(printerName)
There a many examples in the github repo to help you :
https://github.com/tojocky/node-printer/tree/master/examples
来源:https://stackoverflow.com/questions/59225919/use-node-js-to-to-print-data-to-thermal-printer