public interface ToolsUtil
Modifier and Type | Method and Description |
---|---|
void |
calibrate()
Sends the appropriate calibrate command to the printer.
|
void |
printConfigurationLabel()
Sends the appropriate print configuration command to the printer.
|
void |
reset()
Sends the appropriate reset command to the printer.
|
void |
restoreDefaults()
Sends the appropriate restore defaults command to the printer.
|
void |
sendCommand(String command)
Converts the specified command to bytes using the Java default charset and sends the bytes to the printer.
|
void |
sendCommand(String command,
String encoding)
Converts the specified command to bytes using the specified charset "encoding" and sends the bytes to the
printer.
|
void calibrate() throws ConnectionException
ConnectionException
- if an I/O error occurs.void restoreDefaults() throws ConnectionException
ConnectionException
- if an I/O error occurs.void printConfigurationLabel() throws ConnectionException
ConnectionException
- if an I/O error occurs.void sendCommand(String command) throws ConnectionException
command
- the command to send to the printer.ConnectionException
- if an I/O error occurs.void sendCommand(String command, String encoding) throws ConnectionException, UnsupportedEncodingException
command
- the command to send to the printer.encoding
- a character-encoding name (eg. UTF-8).ConnectionException
- if an I/O error occurs.UnsupportedEncodingException
- if the encoding is not supported.void reset() throws ConnectionException
Connection.close()
after this method, as resetting the printer will
terminate the connection.ConnectionException
- if an I/O error occurs.
package test.zebra.sdk.printer.examples;
import com.zebra.sdk.comm.Connection;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.comm.TcpConnection;
import com.zebra.sdk.printer.ZebraPrinter;
import com.zebra.sdk.printer.ZebraPrinterFactory;
import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;
public class ToolsUtilExample {
public static void main(String[] args) throws Exception {
Connection connection = new TcpConnection("192.168.1.101", TcpConnection.DEFAULT_ZPL_TCP_PORT);
try {
connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
printer.reset();
} catch (ConnectionException e) {
e.printStackTrace();
} catch (ZebraPrinterLanguageUnknownException e1) {
e1.printStackTrace();
} finally {
connection.close();
}
}
}
© 2015 ZIH Corp. All Rights Reserved.