Working version

This commit is contained in:
Eden Kirin
2023-08-01 14:20:00 +02:00
parent 75242cda1d
commit 87b17e3745
2 changed files with 51 additions and 1 deletions

View File

@ -169,3 +169,29 @@ async function createInternalStickerZPL(options) {
...options,
});
}
function getAvailablePrinters() {
return new Promise((resolve, reject) => {
const devices = [];
BrowserPrint.getDefaultDevice("printer", device => {
devices.push(device);
const defaultDevice = device;
BrowserPrint.getLocalDevices(deviceList => {
//console.log(deviceList)
deviceList.printer.forEach(device => {
if (!defaultDevice || device.uid != defaultDevice.uid) {
devices.push(device);
}
}, error => {
reject("Error getting local devices");
}, "printer");
resolve(devices);
});
}, error => {
reject(error);
})
})
}