public class PrinterUtil extends Object
package test.zebra.sdk.printer.examples;
import java.io.IOException;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.device.ZebraIllegalArgumentException;
import com.zebra.sdk.printer.NotALinkOsPrinterException;
import com.zebra.sdk.printer.PrinterUtil;
import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;
public class PrinterUtilExample {
private static final String CONNECTION_STRING = "172.30.16.135";
public static void main(String[] args) throws ConnectionException, IOException, ZebraIllegalArgumentException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException {
// Create a few files on the printer
sendContentsExample();
// List the files just created
listFilesExample();
// Silently delete some of the files
deleteFilesExample();
// List the remaining files
listFilesExample();
// Verbosely delete the rest of the files
deleteFilesVerboseExample();
// List the remaining files
listFilesExample();
}
private static void sendContentsExample() throws ConnectionException, IOException {
PrinterUtil.sendContents(CONNECTION_STRING, "^XA^DFR:ZSDK_TEST1.ZPL^FO100,100^A0N,30,30^FDZSDK_Test1.zpl^FS^XZ");
PrinterUtil.sendContents(CONNECTION_STRING, "^XA^DFR:ZSDK_TEST2.ZPL^FO100,100^A0N,30,30^FDZSDK_Test2.zpl^FS^XZ");
PrinterUtil.sendContents(CONNECTION_STRING, "^XA^DFR:ZSDK_TEST3.ZPL^FO100,100^A0N,30,30^FDZSDK_Test3.zpl^FS^XZ");
PrinterUtil.sendContents(CONNECTION_STRING, "^XA^DFR:ZSDK_TEST4.ZPL^FO100,100^A0N,30,30^FDZSDK_Test4.zpl^FS^XZ");
PrinterUtil.sendContents(CONNECTION_STRING, "^XA^DFR:ZSDK_TEST11.ZPL^FO100,100^A0N,30,30^FDZSDK_Test11.zpl^FS^XZ");
PrinterUtil.sendContents(CONNECTION_STRING, "^XA^DFR:ZSDK_TEST12.ZPL^FO100,100^A0N,30,30^FDZSDK_Test12.zpl^FS^XZ");
PrinterUtil.sendContents(CONNECTION_STRING, "^XA^DFR:ZSDK_TEST22.ZPL^FO100,100^A0N,30,30^FDZSDK_Test22.zpl^FS^XZ");
PrinterUtil.sendContents(CONNECTION_STRING, "^XA^DFR:ZSDK_TEST33.ZPL^FO100,100^A0N,30,30^FDZSDK_Test33.zpl^FS^XZ");
PrinterUtil.sendContents(CONNECTION_STRING, "^XA^DFR:ZSDK_TEST44.ZPL^FO100,100^A0N,30,30^FDZSDK_Test44.zpl^FS^XZ");
}
private static void listFilesExample() throws ConnectionException, ZebraIllegalArgumentException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException {
String[] filesOnE = PrinterUtil.listFiles(CONNECTION_STRING, "R:ZSDK_TEST*.*");
System.out.println("--- List of Files on R: ---");
for (String thisFile : filesOnE) {
System.out.println(" - " + thisFile);
}
System.out.println("--- End of List ---");
}
private static void deleteFilesExample() throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException {
System.out.println("Deleting R:ZSDK_TEST1*.ZPL...");
PrinterUtil.deleteFile(CONNECTION_STRING, "R:ZSDK_TEST1*.ZPL");
}
private static void deleteFilesVerboseExample() throws ConnectionException, ZebraPrinterLanguageUnknownException, ZebraIllegalArgumentException, NotALinkOsPrinterException {
System.out.println("Verbosely Deleting R:ZSDK_TEST*.ZPL...");
String[] filesDeleted = PrinterUtil.deleteFileReportDeleted(CONNECTION_STRING, "R:ZSDK_TEST*.ZPL");
for (String thisDeletedFile : filesDeleted) {
System.out.println(" - " + thisDeletedFile + " deleted");
}
}
}
.Modifier and Type | Method and Description |
---|---|
static void |
convertGraphic(String filePathOnPrinter,
ZebraImageI image,
int width,
int height,
OutputStream convertedGraphicOutputStream)
Encodes supplied image in either ZPL or CPCL after dithering and resizing.
|
static void |
convertGraphic(String filePathOnPrinter,
ZebraImageI image,
OutputStream convertedGraphicOutputStream)
Encodes supplied image in either ZPL or CPCL after dithering and resizing.
|
static void |
createBackup(String connectionString,
String profilePath)
Create a backup of your printer's settings, alerts, and files.
|
static void |
createProfile(String connectionString,
String profilePath)
Create a profile of your printer's settings, alerts, and files for cloning to other printers.
|
static void |
deleteFile(String connectionString,
String filePath)
Deletes file(s) from the printer.
|
static String[] |
deleteFileReportDeleted(String connectionString,
String filePath)
Deletes file(s) from the printer and reports what files were actually removed.
|
static PrinterStatus |
getCurrentStatus(Connection printerConnection,
PrinterLanguage language)
Returns a new instance of
PrinterStatus that can be used to determine the status of a printer. |
static void |
getObjectFromPrinter(OutputStream destinationStream,
String connectionString,
String filePathOnPrinter)
Retrieves a file from the printer's file system and writes the contents of that file to an output stream.
|
static byte[] |
getObjectFromPrinter(String connectionString,
String filePathOnPrinter)
Retrieves a file from the printer's file system and returns the contents of that file as a byte[].
|
static void |
getObjectFromPrinterViaFtp(OutputStream destination,
String connectionString,
String filePathOnPrinter,
String ftpPassword)
Retrieves a file from the printer's file system via FTP and writes the contents of that file to an output stream.
|
static byte[] |
getObjectFromPrinterViaFtp(String connectionString,
String filePathOnPrinter,
String ftpPassword)
Retrieves a file from the printer's file system via FTP and returns the contents of that file as a byte[].
|
static List<String> |
getOdometerStatus(String connectionString)
Retrieves status of the printer odometer which includes the total print length, head clean counter, label dot
length, head new, latch open counter, and both user resettable counters.
See ConnectionBuilder for the format of connectionString . |
static List<TcpPortStatus> |
getPortStatus(String connectionString)
Retrieves a list of currently open tcp ports on the printer.
See ConnectionBuilder for the format of connectionString . |
static List<String> |
getPrinterStatus(String connectionString)
Retrieves status of the printer which includes any error messages currently set along with the number of labels
remaining in queue, number of labels remaining in batch, and whether or not a label is currently being processed.
|
static Map<String,Setting> |
getSettingsFromPrinter(String connectionString)
Retrieve all settings and their attributes from the specified printer.
See ConnectionBuilder for the format of connectionString . |
static String[] |
listFiles(String connectionString,
String filter)
Retrieves the names of the files which are stored on the device.
See ConnectionBuilder for the format of connectionString . |
static void |
loadBackup(String connectionString,
String backupPath)
Takes settings, alerts, and files from a backup, and applies them to a printer.
|
static void |
loadBackup(String connectionString,
String backupPath,
boolean isVerbose)
Takes settings, alerts, and files from a backup, and applies them to a printer.
|
static void |
loadProfile(String connectionString,
String profilePath,
FileDeletionOption filesToDelete)
Takes settings, alerts, and files from a profile, and applies them to a printer.
|
static void |
loadProfile(String connectionString,
String profilePath,
FileDeletionOption filesToDelete,
boolean isVerbose)
Takes settings, alerts, and files from a profile, and applies them to a printer.
|
static void |
printConfigLabel(String connectionString)
Causes the specified printer to print a configuration label.
See ConnectionBuilder for the format of connectionString . |
static void |
printDirectoryLabel(String connectionString)
Causes the specified printer to print a directory listing of all the files saved on the printer.
See ConnectionBuilder for the format of connectionString . |
static void |
printNetworkConfigLabel(String connectionString)
Causes the specified printer to print a network configuration label.
See ConnectionBuilder for the format of connectionString . |
static String |
quickStatus(String connectionString)
Retrieves the quick status of the printer.
See ConnectionBuilder for the format of connectionString . |
static void |
resetNetwork(String connectionString)
Resets the network of the specified printer.
|
static void |
resetPrinter(String connectionString)
|
static void |
restoreNetworkDefaults(String connectionString)
Restores the printer's network settings to their factory default configuration.
|
static void |
restorePrinterDefaults(String connectionString)
Restores the printer's settings to their factory default configuration.
See ConnectionBuilder for the format of connectionString . |
static void |
sendContents(String connectionString,
InputStream data)
Send contents of
data directly to the device specified via connectionString using UTF-8
encoding.See ConnectionBuilder for the format of connectionString . |
static void |
sendContents(String connectionString,
InputStream data,
String encoding)
Send contents of
data directly to the device specified via connectionString using
encoding .See ConnectionBuilder for the format of connectionString . |
static void |
sendContents(String connectionString,
String data)
Send contents of
data directly to the device specified via connectionString using UTF-8
encoding. |
static void |
sendContents(String connectionString,
String data,
String encoding)
Send contents of
data directly to the device specified via connectionString using
encoding .See ConnectionBuilder for the format of connectionString . |
static void |
sendJSON(String connectionString,
InputStream data,
String encoding)
Send contents of
data directly to the device specified via connectionString using
encoding .See ConnectionBuilder for the format of connectionString . |
static void |
setClock(String connectionString,
String dateTime)
|
static void |
storeFile(String connectionString,
String filePath,
String remoteName)
Stores the file on the printer at the specified location and name using any required file wrappers.
See ConnectionBuilder for the format of connectionString . |
static void |
updateFirmware(String connection,
String firmwareFilePath,
long timeout)
Update the printer firmware.
|
public static void sendContents(String connectionString, String data) throws ConnectionException, IOException
data
directly to the device specified via connectionString
using UTF-8
encoding. connectionString
.connectionString
- The connection string.data
- Data to send to the printer.IOException
- If there is an error encoding data
.ConnectionException
- If there is an error communicating with the printer.public static void sendContents(String connectionString, String data, String encoding) throws ConnectionException, IOException
data
directly to the device specified via connectionString
using
encoding
.connectionString
.connectionString
- The connection string.data
- Data to send to the printer.encoding
- A character-encoding name (eg. UTF-8).ConnectionException
- If there is an error communicating with the printer.IOException
- If there is an error encoding data
.public static void sendContents(String connectionString, InputStream data) throws ConnectionException, IOException
data
directly to the device specified via connectionString
using UTF-8
encoding.connectionString
.connectionString
- The connection string.data
- Data to send to the printer.ConnectionException
- If there is an error communicating with the printer.IOException
- If there is an error reading from data
.public static void sendContents(String connectionString, InputStream data, String encoding) throws ConnectionException, IOException
data
directly to the device specified via connectionString
using
encoding
.connectionString
.connectionString
- The connection string.data
- Data to send to the printer.encoding
- A character-encoding name (eg. UTF-8).ConnectionException
- If there is an error communicating with the printer.IOException
- If there is an error reading from data
.public static void sendJSON(String connectionString, InputStream data, String encoding) throws ConnectionException, IOException
data
directly to the device specified via connectionString
using
encoding
.connectionString
.connectionString
- The connection string.data
- Data to send to the printer.encoding
- A character-encoding name (eg. UTF-8).ConnectionException
- If there is an error communicating with the printer.IOException
- If there is an error reading from data
.public static List<TcpPortStatus> getPortStatus(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static List<String> getOdometerStatus(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static List<String> getPrinterStatus(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static String quickStatus(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void setClock(String connectionString, String dateTime) throws ConnectionException, ZebraPrinterLanguageUnknownException, ZebraIllegalArgumentException, NotALinkOsPrinterException
connectionString
- The connection string.dateTime
- Format MM-dd-yyyy HH:mm:ssConnectionException
- If there is an error communicating with the printer.ZebraPrinterLanguageUnknownException
- If the printer language can not be determined.ZebraIllegalArgumentException
- If the format of dateTime
is invalid.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static String[] deleteFileReportDeleted(String connectionString, String filePath) throws ConnectionException, ZebraPrinterLanguageUnknownException, ZebraIllegalArgumentException, NotALinkOsPrinterException
filePath
may also
contain wildcards.connectionString
.connectionString
- The connection string. (May be null)filePath
- The location of the file on the printer. Wildcards are also accepted. (e.g. "E:FORMAT.ZPL",
"E:*.*")ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language cannot be determined.ZebraIllegalArgumentException
- If there is an error parsing the directory data returned by the device.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void deleteFile(String connectionString, String filePath) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
filePath
may also contain wildcards.connectionString
.connectionString
- The connection string. (May be null)filePath
- the location of the file on the printer. Wildcards are also accepted. (e.g. "E:FORMAT.ZPL",
"E:*.*")ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language cannot be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static String[] listFiles(String connectionString, String filter) throws ConnectionException, ZebraIllegalArgumentException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string. (May be null)filter
- Filter for returned files. (e.g. "E:*.ZPL", "*:*.*", "R:MYFILE.*")ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language cannot be determined.ZebraIllegalArgumentException
- If there is an error parsing the directory data returned by the device.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static byte[] getObjectFromPrinter(String connectionString, String filePathOnPrinter) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException, ZebraIllegalArgumentException
connectionString
.connectionString
- The connection string.filePathOnPrinter
- file to retrieve. (e.g. "R:MYFILE.PNG")ConnectionException
- If there is an error connecting to the device, or the ftp password is not correct.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.ZebraIllegalArgumentException
- If the filename is invalid or does not exist.public static void getObjectFromPrinter(OutputStream destinationStream, String connectionString, String filePathOnPrinter) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException, ZebraIllegalArgumentException
connectionString
.destinationStream
- Stream to receive file contents.connectionString
- The connection string.filePathOnPrinter
- file to retrieve. (e.g. "R:MYFILE.PNG")ConnectionException
- If there is an error connecting to the device, or the ftp password is not correct.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.ZebraIllegalArgumentException
- If the filename is invalid or does not exist.public static byte[] getObjectFromPrinterViaFtp(String connectionString, String filePathOnPrinter, String ftpPassword) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException, ZebraIllegalArgumentException
connectionString
.connectionString
- The connection string.filePathOnPrinter
- File to retrieve. (e.g. "R:MYFILE.PNG")ftpPassword
- Password to use for ftp, if null a default password will be used.ConnectionException
- If there is an error connecting to the device, or the ftp password is not correct.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.ZebraIllegalArgumentException
- If the filename is invalid or does not exist.public static void getObjectFromPrinterViaFtp(OutputStream destination, String connectionString, String filePathOnPrinter, String ftpPassword) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException, ZebraIllegalArgumentException
connectionString
.destination
- Stream to receive the file contents.connectionString
- The connection string.filePathOnPrinter
- File to retrieve. (e.g. "R:MYFILE.PNG")ftpPassword
- password to use for ftp, if null a default password will be used.ConnectionException
- If there is an error connecting to the device, or the ftp password is not correct.ZebraPrinterLanguageUnknownException
- if the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.ZebraIllegalArgumentException
- If the filename is invalid or does not exist.public static void updateFirmware(String connection, String firmwareFilePath, long timeout) throws ConnectionException, ZebraPrinterLanguageUnknownException, ZebraIllegalArgumentException, DiscoveryException, TimeoutException, FileNotFoundException
connection
.connection
- The connection string.firmwareFilePath
- File path of firmware file.timeout
- Timeout in milliseconds. The minimum allowed timeout is 5 minutes (300000ms) due to the need to
reset the printer after flashing the firmware. If a timeout value less than the minimum is provided, the minimum
will be used instead.ConnectionException
- If the connection can not be opened or is closed prematurely.ZebraPrinterLanguageUnknownException
- If the printer language can not be determined.ZebraIllegalArgumentException
- If an invalid firmware file is specified for the printer.DiscoveryException
- If an error occurs while waiting for the printer to come back online.TimeoutException
- If the maximum timeout is reached prior to the printer coming back online with the new
firmware.FileNotFoundException
- If the firmware file cannot be found or cannot be opened.public static void convertGraphic(String filePathOnPrinter, ZebraImageI image, OutputStream convertedGraphicOutputStream) throws ZebraIllegalArgumentException, IOException
filePathOnPrinter
- The printer file path you wish to store the image to.image
- ZebraImage to be dithered and resized.convertedGraphicOutputStream
- OutputStream to store encoded image data.ZebraIllegalArgumentException
- If the file type is not supported or an invalid image is supplied.IOException
- Could not read/write to file.public static void convertGraphic(String filePathOnPrinter, ZebraImageI image, int width, int height, OutputStream convertedGraphicOutputStream) throws ZebraIllegalArgumentException, IOException
filePathOnPrinter
- The printer file path you wish to store the image to.image
- ZebraImage to be dithered and resized.width
- Width of the resulting image. If 0 the image is not resized.height
- Height of the resulting image. If 0 the image is not resized.convertedGraphicOutputStream
- OutputStream to store converted image data encoded with the printers native
language.ZebraIllegalArgumentException
- If the file type is not supported or an invalid image is supplied.IOException
- Could not read/write to file.public static void createProfile(String connectionString, String profilePath) throws IOException, ZebraIllegalArgumentException, ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.profilePath
- The location of where to store the profile.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.IOException
- If there is an issue creating the profile.ZebraIllegalArgumentException
- Could not interpret the response from the printer.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.ProfileUtil.createProfile(String)
public static void createBackup(String connectionString, String profilePath) throws ConnectionException, IOException, ZebraPrinterLanguageUnknownException, ZebraIllegalArgumentException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.profilePath
- The location of where to store the profile. The extension must be .zprofile; if it is not, the
method will change it to .zprofile for you.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.IOException
- If there is an issue creating the profile.ZebraIllegalArgumentException
- Could not interpret the response from the printer.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.ProfileUtil.createBackup(String)
public static void loadProfile(String connectionString, String profilePath, FileDeletionOption filesToDelete) throws ConnectionException, IOException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
filesToDelete
from the printer.connectionString
.connectionString
- The connection string.profilePath
- Path to the profile to load. (e.g. /home/user/profile.zprofile)filesToDelete
- An enum describing which files to delete.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.IOException
- If there is an issue loading the profile.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void loadProfile(String connectionString, String profilePath, FileDeletionOption filesToDelete, boolean isVerbose) throws ConnectionException, IOException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
filesToDelete
from the printer.connectionString
.connectionString
- The connection string.profilePath
- Path to the profile to load. (e.g. /home/user/profile.zprofile)filesToDelete
- An enum describing which files to delete.isVerbose
- Increases the amount of detail presented to the user.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.IOException
- If there is an issue loading the profile.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void loadBackup(String connectionString, String backupPath) throws ConnectionException, IOException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.backupPath
- Path to the profile to load. (e.g. /home/user/profile.zprofile)ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.IOException
- If there is an issue loading the profile.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void loadBackup(String connectionString, String backupPath, boolean isVerbose) throws ConnectionException, IOException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.backupPath
- Path to the profile to load. (e.g. /home/user/profile.zprofile)isVerbose
- Increases the amount of detail presented to the user.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.IOException
- If there is an issue loading the profile.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void storeFile(String connectionString, String filePath, String remoteName) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException, ZebraIllegalArgumentException, IOException
connectionString
.connectionString
- The connection string.filePath
- The path of the file to store.remoteName
- The path on the printer.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.IOException
- If there is an issue storing the file.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.ZebraIllegalArgumentException
- If there is an issue storing the file.public static void resetPrinter(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
- The connection string.ConnectionException
- If there is an error connecting to the deviceZebraPrinterLanguageUnknownException
- If the printer language could not be determinedNotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void resetNetwork(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the deviceZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void restorePrinterDefaults(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void restoreNetworkDefaults(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void printConfigLabel(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void printNetworkConfigLabel(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static void printDirectoryLabel(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException
connectionString
.connectionString
- The connection string.ConnectionException
- If there is an error connecting to the device.ZebraPrinterLanguageUnknownException
- If the printer language could not be determined.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.public static Map<String,Setting> getSettingsFromPrinter(String connectionString) throws ConnectionException, ZebraPrinterLanguageUnknownException, NotALinkOsPrinterException, SettingsException
connectionString
.connectionString
- The connection string.NotALinkOsPrinterException
- This feature is only available on Link-OS™ printers.ZebraPrinterLanguageUnknownException
- If the printer language can not be determined.ConnectionException
- If there is an error connecting to the device.SettingsException
- If the settings could not be retrieved.public static PrinterStatus getCurrentStatus(Connection printerConnection, PrinterLanguage language) 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.printerConnection
- Connection to the printer.language
- Printer control language to be used.PrinterStatus
.ConnectionException
- if there is an issue communicating with the printer (e.g. the connection is not
open.)PrinterStatus
© 2016 ZIH Corp. All Rights Reserved.