System.setProperty(JposPropertiesConst.JPOS_POPULATOR_FILE_PROP_NAME, "jpos_path");
POSPrinterControl114 printer = (POSPrinterControl114) new POSPrinter();
CashDrawerControl114 cashDrawer = (CashDrawerControl114) new CashDrawer();
try {
printer.open("POSPrinter");
printer.claim(1000);
printer.setDeviceEnabled(true);
printer.printNormal(POSPrinterConst.PTR_S_RECEIPT, "Test Print\n");
cashDrawer.open("CashDrawer");
cashDrawer.claim(1000);
cashDrawer.setDeviceEnabled(true);
cashDrawer.openDrawer();
} catch (JposException e) {
e.printStackTrace();
}finally {
try {
cashDrawer.setDeviceEnabled(false);
cashDrawer.release();
cashDrawer.close();
printer.setDeviceEnabled(false);
printer.release();
printer.close();
} catch (JposException e) {
e.printStackTrace();
}
}
我可以肯定的是,您需要按照您的写作来完全做事。您可以使用
Star Micronics TSP100 Configuration
确保您的打印机连接已连接并尝试使用
printerConnection.write(byteArrayOf(0x1B, 0x70, 0x00, 0x3C, 0xFF.toByte()))
printerConnection.send(100)