Class Profile

Object
com.zebra.sdk.device.Profile
All Implemented Interfaces:
Device, FileUtil, FileUtilLinkOs, AlertProvider, FontUtil, GraphicsUtil, SettingsProvider

public class Profile extends Object implements Device, FileUtil, FontUtil, AlertProvider, FileUtilLinkOs, GraphicsUtil
Interface to access the contents of a .zprofile file.


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.ZebraPrinterFactory;
 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();
             ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.getLinkOsPrinter(connection);
             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();
             ZebraPrinterLinkOs linkOsTargetPrinter = ZebraPrinterFactory.getLinkOsPrinter(targetPrinterConnection);
             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 (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 Details

    • Profile

      public Profile(String pathToProfile) throws FileNotFoundException
      Create a Profile object backed by an existing .zprofile file.
      Parameters:
      pathToProfile - path to the profile file.
      Throws:
      FileNotFoundException - if the file pathToProfile does not exist.
  • Method Details

    • addSupplement

      public void addSupplement(byte[] supplementData) throws IOException
      Adds data to supplement an existing printer profile. Any supplemental data added to a profile, upon loading the profile, will be sent to the printer after all other profile components have been applied.
      Parameters:
      supplementData - byte array containing the data to be used to supplement the printer profile.
      Throws:
      IOException - if there is an error writing to the .zprofile file.
    • getSupplement

      public String getSupplement() throws FileNotFoundException, IOException
      Returns the supplement data within the profile.
      Returns:
      the supplement data within the profile.
      Throws:
      IOException - if there is an error reading the .zprofile file.
      FileNotFoundException - if the .zprofile file cannot be found.
    • addFirmware

      public void addFirmware(String pathToFirmwareFile) throws IOException
      Adds a firmware file to an existing printer profile. Upon loading the profile, if it contains a firmware file, the firmware will be sent to the printer before all other profile components.
      Parameters:
      pathToFirmwareFile - full path to the firmware file to be added to the profile.
      Throws:
      IOException - if there is an error reading pathToFirmwareFile or if there is an error writing to the .zprofile file.
    • addFirmware

      public void addFirmware(String firmwareFileName, byte[] firmwareFileContents) throws IOException
      Adds a firmware file to an existing printer profile. Upon loading the profile, if it contains a firmware file, the firmware will be sent to the printer before all other profile components.
      Parameters:
      firmwareFileName - the name of the firmware file
      firmwareFileContents - the firmware file contents
      Throws:
      IOException - if there is an error reading pathToFirmwareFile or if there is an error writing to the .zprofile file.
    • removeFirmware

      public void removeFirmware() throws IOException
      Removes the firmware file from the profile.
      Throws:
      IOException - if there is an error removing the firmware file from the .zprofile file.
    • getFirmwareFilename

      public String getFirmwareFilename() throws FileNotFoundException, IOException
      Returns the file name of the firmware file within the profile.
      Returns:
      the file name of the firmware file within the profile.
      Throws:
      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.
    • getAvailableSettings

      public Set<String> getAvailableSettings() throws SettingsException
      Retrieve all of the setting identifiers for a profile. These are the IDs that may be used as keys for retrieving and updating settings for a profile.
      Specified by:
      getAvailableSettings in interface SettingsProvider
      Returns:
      Set of identifiers available for a profile.
      Throws:
      SettingsException - if the settings could not be loaded.
      See Also:
    • getSettingValue

      public String getSettingValue(String settingId) throws SettingsException
      Retrieves the profile's setting value for a setting id.
      Specified by:
      getSettingValue in interface SettingsProvider
      Parameters:
      settingId - setting id.
      Returns:
      the setting's value.
      Throws:
      SettingsException - if the setting could not be retrieved.
    • getSettingsValues

      public Map<String,String> getSettingsValues(List<String> listOfSettings) throws SettingsException
      Retrieves the profile's setting values for a list of setting ids.
      Specified by:
      getSettingsValues in interface SettingsProvider
      Parameters:
      listOfSettings - list of setting ids.
      Returns:
      the settings' values.
      Throws:
      SettingsException - if the setting could not be retrieved.
    • getAllSettingValues

      public Map<String,String> getAllSettingValues() throws SettingsException
      Retrieves all of the profile's setting values.
      Specified by:
      getAllSettingValues in interface SettingsProvider
      Returns:
      Values of all the settings provided by the profile.
      Throws:
      SettingsException - if the settings could not be loaded.
      See Also:
    • setSetting

      public void setSetting(String settingId, String value) throws SettingsException
      Change the value of the setting in the profile to the given value.
      Specified by:
      setSetting in interface SettingsProvider
      Parameters:
      settingId - setting id.
      value - The setting's value.
      Throws:
      SettingsException - if the setting is read only, does not exist, or if the setting could not be set.
    • setSettings

      public void setSettings(Map<String,String> settingValuePairs) throws SettingsException
      Set more than one setting.
      Specified by:
      setSettings in interface SettingsProvider
      Parameters:
      settingValuePairs - Map a setting ID to the new value for the setting.
      Throws:
      SettingsException - if the settings cannot be saved in the profile.
    • getSettingRange

      public String getSettingRange(String settingId) throws SettingsException
      Description copied from interface: SettingsProvider
      Retrieves the allowable range for a setting.
      Specified by:
      getSettingRange in interface SettingsProvider
      Parameters:
      settingId - setting id.
      Returns:
      the setting's range as a string
      Throws:
      SettingsException - if the setting does not exist
      See Also:
    • isSettingValid

      public boolean isSettingValid(String settingId, String value) throws SettingsException
      Description copied from interface: SettingsProvider
      Returns true if value is valid for the given setting.
      Specified by:
      isSettingValid in interface SettingsProvider
      Parameters:
      settingId - setting id.
      value - the setting's value
      Returns:
      true if value is valid for the given setting.
      Throws:
      SettingsException - if the setting does not exist
      See Also:
    • isSettingReadOnly

      public boolean isSettingReadOnly(String settingId) throws SettingsException
      Description copied from interface: SettingsProvider
      Returns true if the setting is read only.
      Specified by:
      isSettingReadOnly in interface SettingsProvider
      Parameters:
      settingId - the setting id
      Returns:
      true if the setting is read only
      Throws:
      SettingsException - if the setting does not exist
      See Also:
    • isSettingWriteOnly

      public boolean isSettingWriteOnly(String settingId) throws SettingsException
      Description copied from interface: SettingsProvider
      Returns true if the setting is write only.
      Specified by:
      isSettingWriteOnly in interface SettingsProvider
      Parameters:
      settingId - the setting id
      Returns:
      true if the setting is write only
      Throws:
      SettingsException - if the setting does not exist
      See Also:
    • getSettingType

      public String getSettingType(String settingId) throws SettingsException
      Description copied from interface: SettingsProvider
      Returns the data type of the setting.
      Specified by:
      getSettingType in interface SettingsProvider
      Parameters:
      settingId - the setting id
      Returns:
      the data type of the setting (e.g. string, bool, enum, etc.)
      Throws:
      SettingsException - if the setting does not exist
      See Also:
    • getArchivableSettingValues

      public Map<String,String> getArchivableSettingValues() throws SettingsException
      Retrieve the values of all the settings that are archivable.
      Returns:
      Values of all the settings with the archivable attribute that are in the profile.
      Throws:
      SettingsException - if the settings could not be loaded.
    • getClonableSettingValues

      public Map<String,String> getClonableSettingValues() throws SettingsException
      Retrieve the values of all the settings that are clonable.
      Returns:
      Values of all the settings with the clonable attribute that are in the profile.
      Throws:
      SettingsException - if the settings could not be loaded.
    • getConfiguredAlerts

      public List<PrinterAlert> getConfiguredAlerts() throws ZebraIllegalArgumentException
      A list of objects detailing the alert configurations in a profile.
      Specified by:
      getConfiguredAlerts in interface AlertProvider
      Returns:
      a list of alert objects currently in a profile.
      Throws:
      ZebraIllegalArgumentException - if the alerts could not be extracted from the profile.
    • configureAlert

      public void configureAlert(PrinterAlert alert) throws ConnectionException
      Description copied from interface: AlertProvider
      Configures an alert to be triggered when the alert's condition occurs or becomes resolved.
      Specified by:
      configureAlert in interface AlertProvider
      Parameters:
      alert - the alert to trigger when it's condition occurs or becomes resolved.
      Throws:
      ConnectionException
      See Also:
    • configureAlerts

      public void configureAlerts(List<PrinterAlert> alerts) throws ConnectionException
      Description copied from interface: AlertProvider
      Configures a list of alerts to be triggered when their conditions occur or become resolved.
      Specified by:
      configureAlerts in interface AlertProvider
      Parameters:
      alerts - the list of alerts to trigger when their conditions occur or become resolved.
      Throws:
      ConnectionException
      See Also:
    • removeAlert

      public void removeAlert(PrinterAlert alert) throws ConnectionException
      Removes a configured alert from a profile. They may be reconfigured via the setAlert methods.
      Specified by:
      removeAlert in interface AlertProvider
      Parameters:
      alert - to be removed from the configuration
      Throws:
      ConnectionException
    • removeAllAlerts

      public void removeAllAlerts() throws ConnectionException
      Removes all alerts currently in a profile. They may be reconfigured via the setAlert(s) methods.
      Specified by:
      removeAllAlerts in interface AlertProvider
      Throws:
      ConnectionException - if an I/O error occurs.
    • downloadTtfFont

      public void downloadTtfFont(String sourceFilePath, String pathOnPrinter) throws ConnectionException
      Adds a TrueType® font file to a profile and stores it at the specified path as a TTF.
      Specified by:
      downloadTtfFont in interface FontUtil
      Parameters:
      sourceFilePath - Path to a TrueType® font to be added to the profile.
      pathOnPrinter - Location to save the font file in the profile.
      Throws:
      ConnectionException - if an I/O error occurs.
    • downloadTteFont

      public void downloadTteFont(String sourceFilePath, String pathOnPrinter) throws ConnectionException
      Adds a TrueType® font file to a profile and stores it at the specified path as a TrueType® extension (TTE).
      Specified by:
      downloadTteFont in interface FontUtil
      Parameters:
      sourceFilePath - Path to a TrueType® font to be added to the profile.
      pathOnPrinter - Location to save the font file in the profile.
      Throws:
      ConnectionException - if an I/O error occurs.
    • downloadTtfFont

      public void downloadTtfFont(InputStream sourceInputStream, String pathOnPrinter) throws ConnectionException
      Adds a TrueType® font file to a profile and stores it at the specified path as a TTF.
      Specified by:
      downloadTtfFont in interface FontUtil
      Parameters:
      sourceInputStream - Input Stream containing the font data.
      pathOnPrinter - Location to save the font file in the profile.
      Throws:
      ConnectionException - if an I/O error occurs.
    • downloadTteFont

      public void downloadTteFont(InputStream sourceInputStream, String pathOnPrinter) throws ConnectionException
      Adds a TrueType® font to a profile and stores it at the specified path as a TrueType® extension (TTE).
      Specified by:
      downloadTteFont in interface FontUtil
      Parameters:
      sourceInputStream - Input Stream containing the font data.
      pathOnPrinter - Location to save the font file in the profile.
      Throws:
      ConnectionException - if an I/O error occurs.
    • sendFileContents

      public void sendFileContents(String filePath) throws IllegalStateException
      This method is not valid for a profile.
      Specified by:
      sendFileContents in interface FileUtil
      Parameters:
      filePath -
      Throws:
      IllegalStateException - thrown if this method is called.
    • sendContents

      public void sendContents(String fileNameOnPrinter, byte[] fileContents) throws ConnectionException
      Adds a file to the profile named fileNameOnPrinter with the file contents from fileContents.
      Parameters:
      fileNameOnPrinter - the full name of the file on the printer (e.g "R:SAMPLE.ZPL").
      fileContents - The contents of the file to send.
      Throws:
      ConnectionException - if an I/O error occurs.
    • retrieveFileNames

      public String[] retrieveFileNames()
      Retrieves the names of the files which are in the profile.
      Specified by:
      retrieveFileNames in interface FileUtil
      Returns:
      list of file names.
    • retrieveFileNames

      public String[] retrieveFileNames(String[] extensions)
      Retrieves the names of the files which are stored on the device. This method only returns files which have one of the extensions in extensions.
      Specified by:
      retrieveFileNames in interface FileUtil
      Parameters:
      extensions - the extensions to filter on.
      Returns:
      list of file names.
    • storeFileOnPrinter

      public void storeFileOnPrinter(String filePath) throws ConnectionException, ZebraIllegalArgumentException
      Stores the file in the profile using any required file wrappers.
      Note: If the contents of 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)
      Specified by:
      storeFileOnPrinter in interface FileUtilLinkOs
      Parameters:
      filePath - the full file path (e.g. "C:\\Users\\%USERNAME%\\Documents\\sample.zpl").
      Throws:
      ConnectionException - if there is an error connecting to the device.
      ZebraIllegalArgumentException - if filePath cannot be used to create a printer file name.
    • storeFileOnPrinter

      public void storeFileOnPrinter(String filePath, String fileNameOnPrinter) throws ConnectionException
      Stores the file in the profile at the specified location and name using any required file wrappers.
      Note: If the contents of 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)
      Specified by:
      storeFileOnPrinter in interface FileUtilLinkOs
      Parameters:
      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").
      Throws:
      ConnectionException - if there is an error connecting to the device.
    • storeFileOnPrinter

      public void storeFileOnPrinter(byte[] fileContents, String fileNameOnPrinter) throws ConnectionException
      Stores a file in the profile named fileNameOnPrinter with the file contents from fileContents using any required file wrappers.
      Note: If the 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)
      Specified by:
      storeFileOnPrinter in interface FileUtilLinkOs
      Parameters:
      fileContents - The contents of the file to store.
      fileNameOnPrinter - the full name of the file on the printer (e.g "R:SAMPLE.ZPL").
      Throws:
      ConnectionException - if there is an error connecting to the device.
    • deleteFile

      public void deleteFile(String filePath) throws ConnectionException
      Deletes the file from the profile. The filePath may also contain wildcards.
      Specified by:
      deleteFile in interface FileUtilLinkOs
      Parameters:
      filePath - the location of the file on the printer. Wildcards are also accepted (e.g. "E:FORMAT.ZPL", "E:*.*")
      Throws:
      ConnectionException - if there is an error accessing the profile.
    • getObjectFromPrinter

      public byte[] getObjectFromPrinter(String filePath) throws ZebraIllegalArgumentException
      Retrieves a file from the profile and returns the contents of that file as a byte array. Will retrieve the following file extensions: ZPL, GRF, DAT, BAS, FMT, PNG, LBL, PCX, BMP, WML, CSV, HTM, BAE, TXT.

      Files transferred between different printer models may not be compatible.
      Specified by:
      getObjectFromPrinter in interface FileUtilLinkOs
      Parameters:
      filePath - absolute file path on the printer ("E:SAMPLE.TXT").
      Returns:
      The file contents
      Throws:
      ZebraIllegalArgumentException - if the filePath is invalid, or if the file does not exist on the printer.
    • getObjectFromPrinter

      public void getObjectFromPrinter(OutputStream destinationStream, String filePath) throws ZebraIllegalArgumentException
      Description copied from interface: FileUtilLinkOs
      Retrieves a file from the printer's file system and writes the contents of that file to destinationStream. Will retrieve the following file extensions: ZPL, GRF, DAT, BAS, FMT, PNG, LBL, PCX, BMP, WML, CSV, HTM, TXT.

      Files transferred between different printer models may not be compatible.
      Specified by:
      getObjectFromPrinter in interface FileUtilLinkOs
      Parameters:
      destinationStream - output stream to receive the file contents
      filePath - absolute file path on the printer ("E:SAMPLE.TXT").
      Throws:
      ZebraIllegalArgumentException - if the filePath is invalid, or if the file does not exist on the printer.
      See Also:
    • getObjectFromPrinterViaFtp

      public byte[] getObjectFromPrinterViaFtp(String filePath, String ftpPassword) throws ZebraIllegalArgumentException
      This method is not valid for a profile.
      Specified by:
      getObjectFromPrinterViaFtp in interface FileUtilLinkOs
      Parameters:
      filePath -
      ftpPassword -
      Returns:
      null
      Throws:
      ZebraIllegalArgumentException - thrown if this method is called.
    • getObjectFromPrinterViaFtp

      public void getObjectFromPrinterViaFtp(OutputStream destinationStream, String filePath, String ftpPassword) throws ConnectionException, ZebraIllegalArgumentException
      Description copied from interface: FileUtilLinkOs
      Retrieves a file from the printer's file system via FTP and writes the contents of that file to destinationStream. Will retrieve the following file extensions: ZPL, GRF, DAT, BAS, FMT, PNG, LBL, PCX, BMP, WML, CSV, HTM, TXT.

      Files transferred between different printer models may not be compatible.
      NOTE: This method retrieves files over a network protocol and hence will only work over a TCP connected printer with FTP enabled. If ftpPassword is not provided, a default will be tried.
      Specified by:
      getObjectFromPrinterViaFtp in interface FileUtilLinkOs
      Parameters:
      destinationStream - output stream to receive the file contents
      filePath - 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.
      Throws:
      ConnectionException - if there is an error communicating with the printer, or the ftpPassword is invalid
      ZebraIllegalArgumentException - if the filePath is invalid, or if the file does not exist on the printer.
      See Also:
    • getPrinterDownloadableObjectFromPrinter

      public byte[] getPrinterDownloadableObjectFromPrinter(String filePath) throws ZebraIllegalArgumentException
      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. Will retrieve the following file extensions: ZPL, GRF, DAT, BAS, FMT, PNG, LBL, PCX, BMP, WML, CSV, HTM, BAE, TXT
      Files transferred between different printer models may not be compatible.
      Specified by:
      getPrinterDownloadableObjectFromPrinter in interface FileUtilLinkOs
      Parameters:
      filePath - absolute file path on the printer ("E:SAMPLE.TXT")
      Returns:
      A Zebra printer downloadable file content.
      Throws:
      ZebraIllegalArgumentException - if the filePath is invalid, or if the file does not exist on the printer.
    • getStorageInfo

      public List<StorageInfo> getStorageInfo() throws ConnectionException
      This method is not valid for a profile.
      Specified by:
      getStorageInfo in interface FileUtilLinkOs
      Returns:
      null
      Throws:
      ConnectionException - thrown if this method is called.
      See Also:
    • sendFileContents

      public void sendFileContents(String filePath, ProgressMonitor handler)
      This method is not valid for a profile.
      Specified by:
      sendFileContents in interface FileUtil
      Parameters:
      filePath -
      handler -
      Throws:
      IllegalStateException - thrown if this method is called.
    • retrieveObjectsProperties

      public List<PrinterObjectProperties> retrieveObjectsProperties() throws ZebraIllegalArgumentException
      Description copied from interface: FileUtil
      Retrieves the properties of the objects which are stored on the device.
      Specified by:
      retrieveObjectsProperties in interface FileUtil
      Returns:
      the list of objects with their properties.
      Throws:
      ZebraIllegalArgumentException - if there is an error parsing the directory data returned by the device.
      See Also:
    • getAllSettings

      public Map<String,Setting> getAllSettings() throws SettingsException
      Description copied from interface: SettingsProvider
      Retrieve all settings and their attributes.
      Specified by:
      getAllSettings in interface SettingsProvider
      Returns:
      Map of setting IDs and setting attributes contained in the profile
      Throws:
      SettingsException - if the settings could not be retrieved
      See Also:
    • printImage

      public void printImage(String imageFilePath, int x, int y) throws ConnectionException, IOException
      Description copied from interface: GraphicsUtil
      Prints an image from the connecting device file system to the connected device as a monochrome image.
      Note: if the image resolution is large (e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception.
      Specified by:
      printImage in interface GraphicsUtil
      Parameters:
      imageFilePath - image file to be printed.
      x - horizontal starting position in dots.
      y - vertical starting position in dots.
      Throws:
      ConnectionException - if an I/O error occurs.
      IOException - when the file could not be found, opened, or is an unsupported graphic
      See Also:
    • printImage

      public void printImage(String imageFilePath, int x, int y, int width, int height, boolean insideFormat) throws ConnectionException, IOException
      Description copied from interface: GraphicsUtil
      Prints an image from the connecting device file system to the connected device as a monochrome image.
      Note: if the image resolution is large (e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception.
      Specified by:
      printImage in interface GraphicsUtil
      Parameters:
      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).
      Throws:
      ConnectionException - if an I/O error occurs.
      IOException - when the file could not be found, opened, or is an unsupported graphic
      See Also:
    • printImage

      public void printImage(ZebraImageI image, int x, int y, int width, int height, boolean insideFormat) throws ConnectionException
      Description copied from interface: GraphicsUtil
      Prints an image to the connected device as a monochrome image.
      Note: if the image resolution is large (e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception.
      Specified by:
      printImage in interface GraphicsUtil
      Parameters:
      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).
      Throws:
      ConnectionException - if an I/O error occurs.
      See Also:
    • storeImage

      public void storeImage(String deviceDriveAndFileName, ZebraImageI image, int width, int height) throws ConnectionException, ZebraIllegalArgumentException
      Description copied from interface: GraphicsUtil
      Stores the specified 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 if it is not either BMP or PNG. If the extension is ignored, GRF will be used. If the image resolution is large (e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception.
      Specified by:
      storeImage in interface GraphicsUtil
      Parameters:
      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.
      Throws:
      ConnectionException - if there is an issue communicating with the printer (e.g. the connection is not open).
      ZebraIllegalArgumentException - if printerDriveAndFileName has an incorrect format.
      See Also:
    • storeImage

      public void storeImage(String deviceDriveAndFileName, String imageFullPath, int width, int height) throws ConnectionException, ZebraIllegalArgumentException, IOException
      Description copied from interface: GraphicsUtil
      Stores the specified 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 if it is not either BMP or PNG. If the extension is ignored, GRF will be used. If the image resolution is large (e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception.
      Specified by:
      storeImage in interface GraphicsUtil
      Parameters:
      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.
      Throws:
      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 graphic
      See Also:
    • getSetting

      public Setting getSetting(String settingId) throws SettingsException
      Retrieves the profile's Setting for a setting id.
      Parameters:
      settingId - setting id.
      Returns:
      the Setting
      Throws:
      SettingsException - if the setting could not be retrieved.
    • setSetting

      public void setSetting(String settingId, Setting setting) throws SettingsException
      Change the setting in the profile.
      Parameters:
      settingId - setting id.
      setting - The setting.
      Throws:
      SettingsException - if the setting is malformed, or if the setting could not be set.
    • setAllSettings

      public void setAllSettings(Map<String,Setting> settings) throws SettingsException
      Change settings in the profile.
      Parameters:
      settings - The settings to change
      Throws:
      SettingsException - if a setting is malformed, or one or more settings could not be set.
    • processSettingsViaMap

      public Map<String,String> processSettingsViaMap(Map<String,String> settingValuePairs) throws SettingsException, ConnectionException
      Change or retrieve settings in the profile.
      Specified by:
      processSettingsViaMap in interface SettingsProvider
      Parameters:
      settingValuePairs - The settings to change
      Returns:
      Mapinvalid input: '<'String, String> results of the setting commands
      Throws:
      SettingsException - if a setting is malformed, or one or more settings could not be set.
      ConnectionException - if there is an error communicating with the printer.
    • storeFileOnPrinterProtected

      public void storeFileOnPrinterProtected(String filePath, String authPassword) throws ConnectionException, IOException, ZebraIllegalArgumentException
      Description copied from interface: FileUtilLinkOs
      Stores the file on the printer in Protected Mode, available at the specified location and provided authentication password using the required file wrapper(s). This method provides authentication to store NRD, NRE and PAC file types from the local file system to the printer's file system. Filenames will be truncated to 8.3 format.
      Note: If the fileContents contains any commands which need to be processed by the printer, use FileUtil.sendFileContents(String) instead. These commands include download commands and 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)
      Specified by:
      storeFileOnPrinterProtected in interface FileUtilLinkOs
      Parameters:
      filePath - the full file path (e.g. "C:\\Users\\%USERNAME%\\Documents\\sample.NRD").
      authPassword - the password required to access the stored file on the printer
      Throws:
      ConnectionException - if there is an error connecting to the device.
      IOException - if there is an issue reading the file
      ZebraIllegalArgumentException - if filePath cannot be used to create a printer file name or if authPassword is null or empty.
      See Also:
    • storeFileOnPrinterProtected

      public void storeFileOnPrinterProtected(String filePath, String fileNameOnPrinter, String authPassword) throws ConnectionException, IOException, ZebraIllegalArgumentException
      Description copied from interface: FileUtilLinkOs
      Stores the file on the printer in Protected Mode, available at the specified location, with the specified name and provided authentication password using the required file wrapper(s).

      This method provides authentication to store NRD, NRE and PAC file types from the local file system to the printer's file system. The filename can be up to 16 characters long.

      Note: If the fileContents contains any commands which need to be processed by the printer, use FileUtil.sendFileContents(String) instead. These commands include download commands and 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)
      Specified by:
      storeFileOnPrinterProtected in interface FileUtilLinkOs
      Parameters:
      filePath - the path to the file on the local system to be stored
      fileNameOnPrinter - the desired name for the file when stored on the printer
      authPassword - the password required to store file on the protected printer
      Throws:
      ConnectionException - if a connection error occurs while communicating with the printer
      IOException - if an I/O error occurs during file transfer
      ZebraIllegalArgumentException - if any of the provided arguments are invalid or null
      See Also:
    • deleteFileOnPrinterProtected

      public void deleteFileOnPrinterProtected(String filePath, String authPassword) throws ConnectionException, ZebraIllegalArgumentException
      Description copied from interface: FileUtilLinkOs
      Deletes the file from the printer on protected mode. The filePath may also contain wildcards. When a NRD, NRE and PAC type files is in protected mode printer, it deletes file using the provided authentication password.

      Specified by:
      deleteFileOnPrinterProtected in interface FileUtilLinkOs
      Parameters:
      filePath - the location of the file on the printer. Wildcards are also accepted (e.g. "E:FORMAT.NRD", "E:*.*")
      authPassword - the password required to access the stored file on the protected printer
      Throws:
      ConnectionException - if a connection error occurs while communicating with the printer
      ZebraIllegalArgumentException - if any of the provided arguments are invalid or null
      See Also: