public interface ZebraPrinter extends FileUtil, GraphicsUtil, FormatUtil, ToolsUtil
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.PrinterLanguage;
import com.zebra.sdk.printer.ZebraPrinter;
import com.zebra.sdk.printer.ZebraPrinterFactory;
import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;
public class ZebraPrinterExample {
public static void main(String[] args) throws Exception {
Connection connection = new TcpConnection("10.0.1.18", TcpConnection.DEFAULT_ZPL_TCP_PORT);
try {
connection.open();
ZebraPrinter zPrinter = ZebraPrinterFactory.getInstance(connection);
PrinterLanguage pcLanguage = zPrinter.getPrinterControlLanguage();
System.out.println("Printer Control Language is " + pcLanguage);
connection.close();
} catch (ConnectionException e) {
e.printStackTrace();
} catch (ZebraPrinterLanguageUnknownException e) {
e.printStackTrace();
} finally {
connection.close();
}
}
}
| Modifier and Type | Method and Description |
|---|---|
Connection |
getConnection()
Returns the printer's connection.
|
PrinterStatus |
getCurrentStatus()
Returns a new instance of
PrinterStatus that can be used to determine the status of a printer. |
PrinterLanguage |
getPrinterControlLanguage()
Returns the printer control language (e.g. ZPL or CPCL) of the printer.
|
void |
setConnection(Connection newConnection)
Changes the printer's connection.
|
retrieveFileNames, retrieveFileNames, retrieveObjectsProperties, sendFileContents, sendFileContentsprintImage, printImage, printImage, storeImage, storeImagegetVariableFields, printStoredFormat, printStoredFormat, printStoredFormat, printStoredFormat, retrieveFormatFromPrinter, retrieveFormatFromPrintercalibrate, printConfigurationLabel, reset, restoreDefaults, sendCommand, sendCommandPrinterLanguage getPrinterControlLanguage()
PrinterLanguagePrinterStatus getCurrentStatus() throws ConnectionException
PrinterStatus that can be used to determine the status of a printer. Each
invocation of this method will result in a query of the connected printer. If more than one status value is to be
read, it is recommended that a copy of PrinterStatus is stored locally.PrinterStatus object will only query the printer upon creation. ConnectionException if it is called when the printer cannot communicate.PrinterStatus.ConnectionException - if there is an issue communicating with the printer (e.g. the connection is not
open.)PrinterStatusConnection getConnection()
void setConnection(Connection newConnection)
newConnection - The new connection to be used for communication with the printer.
© 2017 ZIH Corp. All Rights Reserved.