You need to look at the result of Zebra Label Designer to get the variables and then connect them via sdk
Check out the documentation that comes with the ZebraLink SDK, there are tons of good examples on how to print saved formats. Here is one example. In this example, the variable "First Name" is number 12. The variable "Last Name" is number 11.
^XA ^DFE:FORMAT.ZPL ^FS ^FT26,243^A0N,56,55^FH\^FN12"First Name"^FS ^FT26,296^A0N,56,55^FH\^FN11"Last Name"^FS ^FT258,73^A0N,39,38^FH\^FDVisitor^FS ^BY2,4^FT403,376^B7N,4,0,2,2,N^FH^FDSerial Number^FS ^FO5,17^GB601,379,8^FS ^XZ TcpPrinterConnection zebraPrinterConnection = new TcpPrinterConnection("192.168.1.32", TcpPrinterConnection.DEFAULT_ZPL_TCP_PORT); try { zebraPrinterConnection.open(); ZebraPrinter printer = ZebraPrinterFactory.getInstance(zebraPrinterConnection); Map<Integer, String> vars = new HashMap<Integer, String>(); vars.put(12, "John"); vars.put(11, "Smith"); printer.getFormatUtil().printStoredFormat("E:FORMAT.ZPL", vars); zebraPrinterConnection.close(); } catch (ZebraPrinterConnectionException e) { e.printStackTrace(); } catch (ZebraPrinterLanguageUnknownException e) { e.printStackTrace(); }
Ovi tisler
source share