This commit is contained in:
martin
2025-10-08 22:30:59 -03:00
parent b3ebaed097
commit f478feebce

View File

@@ -122,49 +122,6 @@ async function ticketDPSTock(
}
}
async function test() {
/*
const ticket = init()
+ boldOn() + "Ticket de prueba" + boldOff()
+ line(2)
+ "Cliente: Juan Perez"
+ line()
+ "Ticket de prueba"
+ line(30)
+ cut();
printTicketDataRaw(Buffer.from(ticket, 'ascii'))
*/
return;
const ids = findPrinterIds()
if (!ids) {
console.error('No se pudo detectar la impresora USB de manera automatica');
process.exit(1)
}
const { vendor, product } = ids;
console.log(`Usando vendor=0x${vendor?.toString(16)} product=0x${product?.toString(16)}`);
const device = new escpos.USB(vendor, product);
const printer = new escpos.Printer(device);
await new Promise((resolve, reject) => {
device.open((err) => {
if (err) return reject(err)
printer.encode('UTF-8')
.text(' o ')
.text(' /|\\ ')
.text(' / \\ ')
.feed(3)
.cut()
.close()
resolve()
})
})
}
app.listen(3030, () => {
console.log("Servicio de impresion de tickets inicializado en el puerto 3030");
test();
})