var api = dtpweb.DTPWeb.getInstance();
async function updatePrinterList() {
var printerElements = document.getElementById("select-printlist");
if (api) {
var printers = await api.getPrinters({ onlyLocal: false });
printerElements.innerHTML = "";
if (printers instanceof Array && printers.length > 0) {
for (var i = 0; i < printers.length; i++) {
var item = printers[i];
var name = item.hostname && item.type !== 1 ? item.name + "@" + item.hostname : item.name;
var value = item.ip ? item.name + "@" + item.ip : item.name;
printerElements.options.add(new Option(name, value));
}
} else {
printerElements.options.add(new Option("Text", ""));
}
onPrinterChanged();
}
}