I am a complete newbie to kiosk printers.
I need to send a string from a java app to a zebra kr203 kiosk printer.
The machine is hooked up to a windows 7 pc and its drivers are installed. Printing test pages works fine.
I have also installed the setup utilities for the printer and they allow sending commands to it through EPL2 language. Again, I am completeley new to EPL2 but I have tried some example commands and nothing worked.
Can someone please write some basic java code to send a short string to the printer?
No GUI needed just a simple command line app.
EDIT: I found some code on google that gets the correct printService but it still won't print anything out.
EDIT NO. 2: I ended up using the Zebra SDK provided on their website. They keep code examples there which you can easily find by googling. I edited out the old code since it is useless.
Using the SDK and examples I figured out that the printer actually uses ZPL2 instead of EPL as I originally thought.
The SDK has its own API for sending commands at it works quite smoothly for me.
This is what I ended up using:
String defaultPrinter = PrintServiceLookup.lookupDefaultPrintService().getName();
com.zebra.sdk.comm.Connection myconnection = new com.zebra.sdk.comm.DriverPrinterConnection(defaultPrinter,1000,1000);
myconnection.open();
com.zebra.sdk.printer.ZebraPrinter myprinter = ZebraPrinterFactory.getInstance(myconnection);
String command = "^XA\n" +
"^FO50,50\n" +
"^A@N,20,20,E:TT0003M_.FNT\n" +
"^FDUplatili ste XXXX na račun XXXXXXXXXX^FS\n" +
"^FO50,150\n" +
"^A0,32,25\n" +
"^FD"+ date.toString()+ "^FS\n" +
"^FO50,250\n" +
"^A0,32,25^FDSlavnoska Avenija 19, 10000 Zagreb^FS\n" +
"^XZ";
myprinter.sendCommand(command);
myconnection.close();