public class Profile extends Object implements Device, FileUtil, FontUtil, AlertProvider, FileUtilLinkOs, GraphicsUtil
package test.zebra.sdk.device.examples;
import java.io.IOException;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.comm.TcpConnection;
import com.zebra.sdk.device.Profile;
import com.zebra.sdk.device.ZebraIllegalArgumentException;
import com.zebra.sdk.printer.ZebraPrinter;
import com.zebra.sdk.printer.ZebraPrinterFactory;
import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;
import com.zebra.sdk.printer.ZebraPrinterLinkOs;
import com.zebra.sdk.settings.SettingsException;
public class ProfileExample {
public static void main(String[] args) throws Exception {
String pathToProfile = "C:\\MyNewProfile.zprofile";
String printerToClone = "1.2.3.4";
String targetPrinter = "192.168.1.33";
String darknessSettingId = "print.tone";
String newDarknessValue = "10.0";
TcpConnection connection = new TcpConnection(printerToClone, TcpConnection.DEFAULT_ZPL_TCP_PORT);
TcpConnection targetPrinterConnection = new TcpConnection(targetPrinter, TcpConnection.DEFAULT_ZPL_TCP_PORT);
try {
connection.open();
ZebraPrinter genericPrinter = ZebraPrinterFactory.getInstance(connection);
ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.createLinkOsPrinter(genericPrinter);
if (linkOsPrinter != null) {
System.out.println("Start profile operation");
// Create a profile containing the settings from printerToClone.
linkOsPrinter.createProfile(pathToProfile);
System.out.println("Done");
}
connection.close();
// Change the darkness in the profile.
Profile profileForCloning = new Profile(pathToProfile);
if (profileForCloning.getAvailableSettings().contains(darknessSettingId) &&
profileForCloning.isSettingValid(darknessSettingId, newDarknessValue) &&
profileForCloning.isSettingReadOnly(darknessSettingId) == false) {
profileForCloning.setSetting(darknessSettingId, newDarknessValue);
}
targetPrinterConnection.open();
ZebraPrinter genericTargetPrinter = ZebraPrinterFactory.getInstance(targetPrinterConnection);
ZebraPrinterLinkOs linkOsTargetPrinter = ZebraPrinterFactory.createLinkOsPrinter(genericTargetPrinter);
if (linkOsTargetPrinter != null) {
System.out.println("Start cloning operation");
// Clone the profile to targetPrinter
linkOsTargetPrinter.loadProfile(pathToProfile);
System.out.println("Done");
}
} catch (ConnectionException e) {
System.out.println("Could not use connection");
e.printStackTrace();
} catch (ZebraPrinterLanguageUnknownException e) {
System.out.println("Could not recognize Zebra printer");
e.printStackTrace();
} catch (ZebraIllegalArgumentException e) {
System.out.println("Unexpected response from Zebra printer");
e.printStackTrace();
} catch (IOException e) {
System.out.println("Could not write to " + pathToProfile);
e.printStackTrace();
} catch (SettingsException e) {
System.out.println("Could not access " + darknessSettingId);
e.printStackTrace();
} finally {
connection.close();
targetPrinterConnection.close();
}
}
}
Constructor and Description |
---|
Profile(String pathToProfile)
Create a
Profile object backed by an existing .zprofile file. |
Modifier and Type | Method and Description |
---|---|
void |
addFirmware(String pathToFirmwareFile)
Adds a firmware file to an existing printer profile.
|
void |
addFirmware(String firmwareFileName,
byte[] firmwareFileContents)
Adds a firmware file to an existing printer profile.
|
void |
addSupplement(byte[] supplementData)
Adds data to supplement an existing printer profile.
|
void |
configureAlert(PrinterAlert alert)
Configures an alert to be triggered when the alert's condition occurs or becomes resolved.
|
void |
configureAlerts(List<PrinterAlert> alerts)
Configures a list of alerts to be triggered when their conditions occur or become resolved.
|
void |
deleteFile(String filePath)
Deletes the file from the profile.
|
void |
downloadTteFont(InputStream sourceInputStream,
String pathOnPrinter)
Adds a TrueType® font to a profile and stores it at the specified path as a TrueType® extension (TTE).
|
void |
downloadTteFont(String sourceFilePath,
String pathOnPrinter)
Adds a TrueType® font file to a profile and stores it at the specified path as a TrueType® extension
(TTE).
|
void |
downloadTtfFont(InputStream sourceInputStream,
String pathOnPrinter)
Adds a TrueType® font file to a profile and stores it at the specified path as a TTF.
|
void |
downloadTtfFont(String sourceFilePath,
String pathOnPrinter)
Adds a TrueType® font file to a profile and stores it at the specified path as a TTF.
|
Map<String,Setting> |
getAllSettings()
Retrieve all settings and their attributes.
|
Map<String,String> |
getAllSettingValues()
Retrieves all of the profile's setting values.
|
Map<String,String> |
getArchivableSettingValues()
Retrieve the values of all the settings that are archivable.
|
Set<String> |
getAvailableSettings()
Retrieve all of the setting identifiers for a profile.
|
Map<String,String> |
getClonableSettingValues()
Retrieve the values of all the settings that are clonable.
|
List<PrinterAlert> |
getConfiguredAlerts()
A list of objects detailing the alert configurations in a profile.
|
String |
getFirmwareFilename()
Returns the file name of the firmware file within the profile.
|
void |
getObjectFromPrinter(OutputStream destinationStream,
String filePath)
Retrieves a file from the printer's file system and writes the contents of that file to destinationStream.
|
byte[] |
getObjectFromPrinter(String filePath)
Retrieves a file from the profile and returns the contents of that file as a byte array.
|
void |
getObjectFromPrinterViaFtp(OutputStream destinationStream,
String filePath,
String ftpPassword)
Retrieves a file from the printer's file system via FTP and writes the contents of that file to
destinationStream.
|
byte[] |
getObjectFromPrinterViaFtp(String filePath,
String ftpPassword)
This method is not valid for a profile.
|
byte[] |
getPrinterDownloadableObjectFromPrinter(String filePath)
Retrieves a file from the profile and returns the contents of that file as a byte array including all necessary
file wrappers for redownloading to a Zebra printer.
|
Setting |
getSetting(String settingId)
Retrieves the profile's
Setting for a setting id. |
String |
getSettingRange(String settingId)
Retrieves the allowable range for a setting.
|
Map<String,String> |
getSettingsValues(List<String> listOfSettings)
Retrieves the profile's setting values for a list of setting ids.
|
String |
getSettingType(String settingId)
Returns the data type of the setting.
|
String |
getSettingValue(String settingId)
Retrieves the profile's setting value for a setting id.
|
List<StorageInfo> |
getStorageInfo()
This method is not valid for a profile.
|
String |
getSupplement()
Returns the supplement data within the profile.
|
boolean |
isSettingReadOnly(String settingId)
Returns true if the setting is read only.
|
boolean |
isSettingValid(String settingId,
String value)
Returns true if value is valid for the given setting.
|
boolean |
isSettingWriteOnly(String settingId)
Returns true if the setting is write only.
|
void |
printImage(String imageFilePath,
int x,
int y)
Prints an image from the connecting device file system to the connected device as a monochrome image.
|
void |
printImage(String imageFilePath,
int x,
int y,
int width,
int height,
boolean insideFormat)
Prints an image from the connecting device file system to the connected device as a monochrome image.
|
void |
printImage(ZebraImageI image,
int x,
int y,
int width,
int height,
boolean insideFormat)
Prints an image to the connected device as a monochrome image.
|
Map<String,String> |
processSettingsViaMap(Map<String,String> settingValuePairs)
Change or retrieve settings in the profile.
|
void |
removeAlert(PrinterAlert alert)
Removes a configured alert from a profile.
|
void |
removeAllAlerts()
Removes all alerts currently in a profile.
|
void |
removeFirmware()
Removes the firmware file from the profile.
|
String[] |
retrieveFileNames()
Retrieves the names of the files which are in the profile.
|
String[] |
retrieveFileNames(String[] extensions)
Retrieves the names of the files which are stored on the device.
|
List<PrinterObjectProperties> |
retrieveObjectsProperties()
Retrieves the properties of the objects which are stored on the device.
|
void |
sendContents(String fileNameOnPrinter,
byte[] fileContents)
Adds a file to the profile named
fileNameOnPrinter with the file contents from
fileContents . |
void |
sendFileContents(String filePath)
This method is not valid for a profile.
|
void |
sendFileContents(String filePath,
ProgressMonitor handler)
This method is not valid for a profile.
|
void |
setAllSettings(Map<String,Setting> settings)
Change settings in the profile.
|
void |
setSetting(String settingId,
Setting setting)
Change the setting in the profile.
|
void |
setSetting(String settingId,
String value)
Change the value of the setting in the profile to the given value.
|
void |
setSettings(Map<String,String> settingValuePairs)
Set more than one setting.
|
void |
storeFileOnPrinter(byte[] fileContents,
String fileNameOnPrinter)
Stores a file in the profile named
fileNameOnPrinter with the file contents from
fileContents using any required file wrappers. |
void |
storeFileOnPrinter(String filePath)
Stores the file in the profile using any required file wrappers.
|
void |
storeFileOnPrinter(String filePath,
String fileNameOnPrinter)
Stores the file in the profile at the specified location and name using any required file wrappers.
|
void |
storeImage(String deviceDriveAndFileName,
String imageFullPath,
int width,
int height)
Stores the specified
image to the connected printer as a monochrome image. |
void |
storeImage(String deviceDriveAndFileName,
ZebraImageI image,
int width,
int height)
Stores the specified
image to the connected printer as a monochrome image. |
public Profile(String pathToProfile) throws FileNotFoundException
Profile
object backed by an existing .zprofile file.pathToProfile
- path to the profile file.FileNotFoundException
- If the file pathToProfile
does not exist.public void addSupplement(byte[] supplementData) throws IOException
supplementData
- byte array containing the data to be used to supplement the printer profile.IOException
- if there is an error writing to the .zprofile file.public String getSupplement() throws FileNotFoundException, IOException
IOException
- if there is an error reading the .zprofile file.FileNotFoundException
- if the .zprofile file cannot be found.public void addFirmware(String pathToFirmwareFile) throws IOException
pathToFirmwareFile
- full path to the firmware file to be added to the profile.IOException
- if there is an error reading pathToFirmwareFile
or if there is an error writing
to the .zprofile file.public void addFirmware(String firmwareFileName, byte[] firmwareFileContents) throws IOException
firmwareFileName
- the name of the firmware filefirmwareFileContents
- the firmware file contentsIOException
- if there is an error reading pathToFirmwareFile
or if there is an error writing
to the .zprofile file.public void removeFirmware() throws IOException
IOException
- if there is an error removing the firmware file from the .zprofile file.public String getFirmwareFilename() throws FileNotFoundException, IOException
IOException
- if there is an error reading the firmware file name in the .zprofile file.FileNotFoundException
- if the firmware file cannot be found in the .zprofile file.public Set<String> getAvailableSettings() throws SettingsException
getAvailableSettings
in interface SettingsProvider
SettingsException
- if the settings could not be loaded.SettingsProvider.getSettingValue(String)
public String getSettingValue(String settingId) throws SettingsException
getSettingValue
in interface SettingsProvider
settingId
- setting id.SettingsException
- if the setting could not be retrieved.public Map<String,String> getSettingsValues(List<String> listOfSettings) throws SettingsException
getSettingsValues
in interface SettingsProvider
listOfSettings
- list of setting ids.SettingsException
- if the setting could not be retrieved.public Map<String,String> getAllSettingValues() throws SettingsException
getAllSettingValues
in interface SettingsProvider
SettingsException
- if the settings could not be loaded.SettingsProvider.getAllSettingValues()
public void setSetting(String settingId, String value) throws SettingsException
setSetting
in interface SettingsProvider
settingId
- setting id.value
- The setting's value.SettingsException
- if the setting is read only, does not exist, or if the setting could not be set.public void setSettings(Map<String,String> settingValuePairs) throws SettingsException
setSettings
in interface SettingsProvider
settingValuePairs
- Map a setting ID to the new value for the setting.SettingsException
- If the settings cannot be saved in the profile.public String getSettingRange(String settingId) throws SettingsException
SettingsProvider
getSettingRange
in interface SettingsProvider
settingId
- setting id.SettingsException
- if the setting does not existSettingsProvider.getSettingRange(java.lang.String)
public boolean isSettingValid(String settingId, String value) throws SettingsException
SettingsProvider
isSettingValid
in interface SettingsProvider
settingId
- setting id.value
- the setting's valueSettingsException
- if the setting does not existSettingsProvider.isSettingValid(java.lang.String, java.lang.String)
public boolean isSettingReadOnly(String settingId) throws SettingsException
SettingsProvider
isSettingReadOnly
in interface SettingsProvider
settingId
- the setting idSettingsException
- if the setting does not existSettingsProvider.isSettingReadOnly(java.lang.String)
public boolean isSettingWriteOnly(String settingId) throws SettingsException
SettingsProvider
isSettingWriteOnly
in interface SettingsProvider
settingId
- the setting idSettingsException
- if the setting does not existSettingsProvider.isSettingWriteOnly(java.lang.String)
public String getSettingType(String settingId) throws SettingsException
SettingsProvider
getSettingType
in interface SettingsProvider
settingId
- the setting idSettingsException
- if the setting does not existSettingsProvider.getSettingType(java.lang.String)
public Map<String,String> getArchivableSettingValues() throws SettingsException
SettingsException
- if the settings could not be loaded.public Map<String,String> getClonableSettingValues() throws SettingsException
SettingsException
- If the settings could not be loaded.public List<PrinterAlert> getConfiguredAlerts() throws ZebraIllegalArgumentException
getConfiguredAlerts
in interface AlertProvider
ZebraIllegalArgumentException
- if the alerts could not be extracted from the profile.public void configureAlert(PrinterAlert alert) throws ConnectionException
AlertProvider
configureAlert
in interface AlertProvider
alert
- the alert to trigger when it's condition occurs or becomes resolved.ConnectionException
AlertProvider.configureAlert(com.zebra.sdk.printer.PrinterAlert)
public void configureAlerts(List<PrinterAlert> alerts) throws ConnectionException
AlertProvider
configureAlerts
in interface AlertProvider
alerts
- the list of alerts to trigger when their conditions occur or become resolved.ConnectionException
AlertProvider.configureAlerts(java.util.List)
public void removeAlert(PrinterAlert alert) throws ConnectionException
removeAlert
in interface AlertProvider
alert
- to be removed from the configurationConnectionException
public void removeAllAlerts() throws ConnectionException
removeAllAlerts
in interface AlertProvider
ConnectionException
- If an I/O error occurs.public void downloadTtfFont(String sourceFilePath, String pathOnPrinter) throws ConnectionException
downloadTtfFont
in interface FontUtil
sourceFilePath
- Path to a TrueType® font to be added to the profile.pathOnPrinter
- Location to save the font file in the profile.ConnectionException
- If an I/O error occurs.public void downloadTteFont(String sourceFilePath, String pathOnPrinter) throws ConnectionException
downloadTteFont
in interface FontUtil
sourceFilePath
- Path to a TrueType® font to be added to the profile.pathOnPrinter
- Location to save the font file in the profile.ConnectionException
- If an I/O error occurs.public void downloadTtfFont(InputStream sourceInputStream, String pathOnPrinter) throws ConnectionException
downloadTtfFont
in interface FontUtil
sourceInputStream
- Input Stream containing the font data.pathOnPrinter
- Location to save the font file in the profile.ConnectionException
- If an I/O error occurs.public void downloadTteFont(InputStream sourceInputStream, String pathOnPrinter) throws ConnectionException
downloadTteFont
in interface FontUtil
sourceInputStream
- Input Stream containing the font data.pathOnPrinter
- Location to save the font file in the profile.ConnectionException
- If an I/O error occurs.public void sendFileContents(String filePath) throws IllegalStateException
sendFileContents
in interface FileUtil
filePath
- IllegalStateException
- thrown if this method is called.public void sendContents(String fileNameOnPrinter, byte[] fileContents) throws ConnectionException
fileNameOnPrinter
with the file contents from
fileContents
.fileNameOnPrinter
- the full name of the file on the printer (e.g "R:SAMPLE.ZPL").fileContents
- The contents of the file to send.ConnectionException
- If an I/O error occurs.public String[] retrieveFileNames()
retrieveFileNames
in interface FileUtil
public String[] retrieveFileNames(String[] extensions)
extensions
.retrieveFileNames
in interface FileUtil
extensions
- the extensions to filter on.public void storeFileOnPrinter(String filePath) throws ConnectionException, ZebraIllegalArgumentException
filePath
contains any commands which need to be processed by the
printer, use FileUtil.sendFileContents(String)
instead! These commands include download commands any
immediate commands (~CC, ~CD, ~DB, ~DE, ~DG, ~DY, ~EG, ~HI, ~HU, ~HM, ~HQ, ~HS, ~JA, ~JB, ~JC, ~JD, ~JE, ~JF,
~JG, ~JI, ~JL, ~JN, ~JO, ~JP, ~JQ, ~JR, ~JS, ~JX, ~NC, ~NT, ~PL, ~PP, ~PR, ~PS, ~RO, ~SD, ~TA, ~WC, ~WQ, ^DF)storeFileOnPrinter
in interface FileUtilLinkOs
filePath
- the full file path (e.g. "C:\\Users\\%USERNAME%\\Documents\\sample.zpl").ConnectionException
- If there is an error connecting to the device.ZebraIllegalArgumentException
- If filePath cannot be used to create a printer file name.public void storeFileOnPrinter(String filePath, String fileNameOnPrinter) throws ConnectionException
filePath
contains any commands which need to be processed by the
printer, use FileUtil.sendFileContents(String)
instead! These commands include download commands any
immediate commands (~CC, ~CD, ~DB, ~DE, ~DG, ~DY, ~EG, ~HI, ~HU, ~HM, ~HQ, ~HS, ~JA, ~JB, ~JC, ~JD, ~JE, ~JF,
~JG, ~JI, ~JL, ~JN, ~JO, ~JP, ~JQ, ~JR, ~JS, ~JX, ~NC, ~NT, ~PL, ~PP, ~PR, ~PS, ~RO, ~SD, ~TA, ~WC, ~WQ, ^DF)storeFileOnPrinter
in interface FileUtilLinkOs
filePath
- the full file path (e.g. "C:\\Users\\%USERNAME%\\Documents\\sample.zpl").fileNameOnPrinter
- the full name of the file on the printer (e.g "R:SAMPLE.ZPL").ConnectionException
- If there is an error connecting to the device.public void storeFileOnPrinter(byte[] fileContents, String fileNameOnPrinter) throws ConnectionException
fileNameOnPrinter
with the file contents from
fileContents
using any required file wrappers. fileContents
contains any commands which need to be processed by the printer,
use FileUtil.sendFileContents(String)
instead! These commands include download commands any immediate
commands (~CC, ~CD, ~DB, ~DE, ~DG, ~DY, ~EG, ~HI, ~HU, ~HM, ~HQ, ~HS, ~JA, ~JB, ~JC, ~JD, ~JE, ~JF, ~JG, ~JI,
~JL, ~JN, ~JO, ~JP, ~JQ, ~JR, ~JS, ~JX, ~NC, ~NT, ~PL, ~PP, ~PR, ~PS, ~RO, ~SD, ~TA, ~WC, ~WQ, ^DF)storeFileOnPrinter
in interface FileUtilLinkOs
fileContents
- The contents of the file to store.fileNameOnPrinter
- the full name of the file on the printer (e.g "R:SAMPLE.ZPL").ConnectionException
- If there is an error connecting to the device.public void deleteFile(String filePath) throws ConnectionException
filePath
may also contain wildcards.deleteFile
in interface FileUtilLinkOs
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 accessing the profile.public byte[] getObjectFromPrinter(String filePath) throws ZebraIllegalArgumentException
getObjectFromPrinter
in interface FileUtilLinkOs
filePath
- absolute file path on the printer ("E:SAMPLE.TXT").ZebraIllegalArgumentException
- if the filePath is invalid, or if the file does not exist on the printer.public void getObjectFromPrinter(OutputStream destinationStream, String filePath) throws ZebraIllegalArgumentException
FileUtilLinkOs
getObjectFromPrinter
in interface FileUtilLinkOs
destinationStream
- output stream to receive the file contentsfilePath
- absolute file path on the printer ("E:SAMPLE.TXT").ZebraIllegalArgumentException
- if the filePath is invalid, or if the file does not exist on the printer.FileUtilLinkOs.getObjectFromPrinter(java.io.OutputStream, java.lang.String)
public byte[] getObjectFromPrinterViaFtp(String filePath, String ftpPassword) throws ZebraIllegalArgumentException
getObjectFromPrinterViaFtp
in interface FileUtilLinkOs
filePath
- ftpPassword
- ZebraIllegalArgumentException
- thrown if this method is called.public void getObjectFromPrinterViaFtp(OutputStream destinationStream, String filePath, String ftpPassword) throws ConnectionException, ZebraIllegalArgumentException
FileUtilLinkOs
ftpPassword
is not provided, a default will be tried.getObjectFromPrinterViaFtp
in interface FileUtilLinkOs
destinationStream
- output stream to receive the file contentsfilePath
- absolute file path on the printer ("E:SAMPLE.TXT")ftpPassword
- password used to login to FTP, if null, a default password ("1234") will be used.ConnectionException
- if there is an error communicating with the printer, or the ftpPassword is invalidZebraIllegalArgumentException
- if the filePath is invalid, or if the file does not exist on the printer.FileUtilLinkOs.getObjectFromPrinterViaFtp(java.io.OutputStream, java.lang.String,
java.lang.String)
public byte[] getPrinterDownloadableObjectFromPrinter(String filePath) throws ZebraIllegalArgumentException
getPrinterDownloadableObjectFromPrinter
in interface FileUtilLinkOs
filePath
- absolute file path on the printer ("E:SAMPLE.TXT")ZebraIllegalArgumentException
- if the filePath is invalid, or if the file does not exist on the printer.public List<StorageInfo> getStorageInfo() throws ConnectionException
getStorageInfo
in interface FileUtilLinkOs
ConnectionException
- thrown if this method is called.StorageInfo class for more information.
public void sendFileContents(String filePath, ProgressMonitor handler)
sendFileContents
in interface FileUtil
filePath
- handler
- IllegalStateException
- thrown if this method is called.public List<PrinterObjectProperties> retrieveObjectsProperties() throws ZebraIllegalArgumentException
FileUtil
retrieveObjectsProperties
in interface FileUtil
ZebraIllegalArgumentException
- if there is an error parsing the directory data returned by the device.FileUtil.retrieveObjectsProperties()
public Map<String,Setting> getAllSettings() throws SettingsException
SettingsProvider
getAllSettings
in interface SettingsProvider
SettingsException
- if the settings could not be retrievedSettingsProvider.getAllSettings()
public void printImage(String imageFilePath, int x, int y) throws ConnectionException, IOException
GraphicsUtil
OutOfMemoryError
exception.printImage
in interface GraphicsUtil
imageFilePath
- image file to be printed.x
- horizontal starting position in dots.y
- vertical starting position in dots.ConnectionException
- if an I/O error occurs.IOException
- when the file could not be found, opened, or is an unsupported graphicGraphicsUtil.printImage(java.lang.String, int, int)
public void printImage(String imageFilePath, int x, int y, int width, int height, boolean insideFormat) throws ConnectionException, IOException
GraphicsUtil
OutOfMemoryError
exception.printImage
in interface GraphicsUtil
imageFilePath
- image file to be printed.x
- horizontal starting position in dots.y
- vertical starting position in dots.width
- desired width of the printed image. Passing a value less than 1 will preserve original width.height
- desired height of the printed image. Passing a value less than 1 will preserve original height.insideFormat
- boolean value indicating whether this image should be printed by itself (false), or is part
of a format being written to the connection (true).ConnectionException
- if an I/O error occurs.IOException
- when the file could not be found, opened, or is an unsupported graphicGraphicsUtil.printImage(java.lang.String, int, int, int, int, boolean)
public void printImage(ZebraImageI image, int x, int y, int width, int height, boolean insideFormat) throws ConnectionException
GraphicsUtil
OutOfMemoryError
exception.printImage
in interface GraphicsUtil
image
- the image to be printed.x
- horizontal starting position in dots.y
- vertical starting position in dots.width
- desired width of the printed image. Passing a value less than 1 will preserve original width.height
- desired height of the printed image. Passing a value less than 1 will preserve original height.insideFormat
- boolean value indicating whether this image should be printed by itself (false), or is part
of a format being written to the connection (true).ConnectionException
- if an I/O error occurs.GraphicsUtil.printImage(com.zebra.sdk.graphics.ZebraImageI, int, int, int, int,
boolean)
public void storeImage(String deviceDriveAndFileName, ZebraImageI image, int width, int height) throws ConnectionException, ZebraIllegalArgumentException
GraphicsUtil
image
to the connected printer as a monochrome image. The image will be stored
on the printer at printerDriveAndFileName
with the extension GRF. If a drive letter is not supplied,
E will be used as the default (e.g. FILE becomes E:FILE.GRF). If an extension is supplied, it is ignored
(E:FILE.BMP becomes E:FILE.GRF). OutOfMemoryError
exception. storeImage
in interface GraphicsUtil
deviceDriveAndFileName
- path on the printer where the image will be stored.image
- the image to be stored on the printer.width
- desired width of the printed image, in dots. Passing -1 will preserve original width.height
- desired height of the printed image, in dots. Passing -1 will preserve original height.ConnectionException
- if there is an issue communicating with the printer (e.g. the connection is not
open).ZebraIllegalArgumentException
- if printerDriveAndFileName
has an incorrect format.GraphicsUtil.storeImage(java.lang.String, com.zebra.sdk.graphics.ZebraImageI, int,
int)
public void storeImage(String deviceDriveAndFileName, String imageFullPath, int width, int height) throws ConnectionException, ZebraIllegalArgumentException, IOException
GraphicsUtil
image
to the connected printer as a monochrome image. The image will be stored
on the printer at printerDriveAndFileName
with the extension GRF. If a drive letter is not supplied,
E will be used as the default (e.g. FILE becomes E:FILE.GRF). If an extension is supplied, it is ignored
(E:FILE.BMP becomes E:FILE.GRF). OutOfMemoryError
exception. storeImage
in interface GraphicsUtil
deviceDriveAndFileName
- path on the printer where the image will be stored.imageFullPath
- image file to be stored on the printer.width
- desired width of the printed image, in dots. Passing -1 will preserve original width.height
- desired height of the printed image, in dots. Passing -1 will preserve original height.ConnectionException
- if there is an issue communicating with the printer (e.g. the connection is not
open).ZebraIllegalArgumentException
- if printerDriveAndFileName
has an incorrect format.IOException
- when the file could not be found, opened, or is an unsupported graphicGraphicsUtil.storeImage(java.lang.String, java.lang.String, int, int)
public Setting getSetting(String settingId) throws SettingsException
Setting
for a setting id.settingId
- setting id.Setting
SettingsException
- if the setting could not be retrieved.public void setSetting(String settingId, Setting setting) throws SettingsException
settingId
- setting id.setting
- The setting.SettingsException
- if the setting is malformed, or if the setting could not be set.public void setAllSettings(Map<String,Setting> settings) throws SettingsException
settings
- The settings to changeSettingsException
- if a setting is malformed, or one or more settings could not be set.public Map<String,String> processSettingsViaMap(Map<String,String> settingValuePairs) throws SettingsException, ConnectionException
processSettingsViaMap
in interface SettingsProvider
settingValuePairs
- The settings to changeSettingsException
- if a setting is malformed, or one or more settings could not be set.ConnectionException
- If there is an error communicating with the printer.
© 2015 ZIH Corp. All Rights Reserved.