如何打印包含变量的预制标签(使用 Zeba Label Designer 制作)并在打印前设置这些变量。
我有以下代码,但我不确定如何设置变量(例如,我设计的标签中有一个二维码,我想在打印前设置它的数据)。
TcpPrinterConnection zebraPrinterConnection = new TcpPrinterConnection("192.168.1.100", TcpPrinterConnection.DEFAULT_ZPL_TCP_PORT);
try {
ZebraPrinter printer = ZebraPrinterFactory.getInstance(zebraPrinterConnection);
printer.getFileUtil().sendFileContents("/sdcard/documents/labels/sample.lbl");
zebraPrinterConnection.close();
} catch (ZebraPrinterConnectionException e) {
e.printStackTrace();
} catch (ZebraPrinterLanguageUnknownException e) {
e.printStackTrace();
} catch (ZebraIllegalArgumentException e) {
e.printStackTrace();
}