How can I develop Java Software to print reciepts with an Epson reciept printer?
System.setProperty(JposPropertiesConst.JPOS_POPULATOR_FILE_PROP_NAME, System.getenv("jposxml_path"));
I used a system-enviroment variable but you can use of course any other way to specify the path.Now you are ready to go!
Example:
POSPrinterControl113 printer = (jpos.POSPrinterControl113) new POSPrinter();
CashDrawerControl113 drawer = (CashDrawerControl113) new CashDrawer();
try {
printer.open("POSPrinter");
printer.claim(100);
printer.setDeviceEnabled(true);
} catch (Exception e) {
System.err.println("Printer deactivated " + e.getMessage());
printerdisabled = true;
drawerdisabled = true;
return;
}
try {
drawer.open("CashDrawer");
drawer.claim(100);
drawer.setDeviceEnabled(true);
} catch (Exception e) {
System.out.println("Cashdrawer deactivated: " + e.getMessage());
drawerdisabled = true;
return;
}