Class ZebraPrinterFactory

Object
com.zebra.sdk.printer.ZebraPrinterFactory

public class ZebraPrinterFactory extends Object
A factory used to acquire an instance of a ZebraPrinter.
  • Method Details

    • getInstance

      public static ZebraPrinter getInstance(Connection connection) throws ConnectionException, ZebraPrinterLanguageUnknownException
      Factory method to create the correct ZebraPrinter concrete class based on the printer's control language. If the Set-Get-Do value, appl.name, starts with one of the following, the printer is determined to be a CPCL printer. Otherwise it is considered to be a ZPL printer
      • SH
      • H8
      • C
      If you wish to use prefixes other than the ones listed above, use getInstance(String[], Connection)
      Parameters:
      connection - an open connection to a printer
      Returns:
      an instance of a ZebraPrinter
      Throws:
      ConnectionException - if an I/O error occurs
      ZebraPrinterLanguageUnknownException - if the printer language cannot be determined
    • getInstance

      public static ZebraPrinter getInstance(String[] cpclFwVersionPrefixes, Connection connection) throws ConnectionException, ZebraPrinterLanguageUnknownException
      Factory method to create the correct ZebraPrinter concrete class based on the printer's control language. If the Set-Get-Do value, appl.name, starts with one of the cpclFwVersionPrefixes, the printer is determined to be a CPCL printer. Otherwise it is considered to be a ZPL printer
      Parameters:
      cpclFwVersionPrefixes - an array of possible CPCL version number prefixes
      connection - an open connection to a printer
      Returns:
      an instance of a ZebraPrinter
      Throws:
      ConnectionException - if an I/O error occurs
      ZebraPrinterLanguageUnknownException - if the printer language cannot be determined
    • getInstance

      public static ZebraPrinter getInstance(PrinterLanguage language, Connection connection) throws ConnectionException
      Factory method to create the correct ZebraPrinter concrete class based on the provided printer control language.
      Parameters:
      language - the language of the printer instance to be created
      connection - an open connection to a printer
      Returns:
      an instance of a ZebraPrinter
      Throws:
      ConnectionException - if an I/O error occurs
    • createLinkOsPrinter

      public static ZebraPrinterLinkOs createLinkOsPrinter(ZebraPrinter genericPrinter) throws ConnectionException
      Create a wrapper around a Zebra printer that provides access to Link-OS™ features. This method will query the printer for its Link-OS™ version and its control language.
      Parameters:
      genericPrinter - An instance of a ZebraPrinter.
      Returns:
      a Link-OS™ printer
      Throws:
      ConnectionException - if an I/O error occurs
    • createLinkOsPrinter

      public static ZebraPrinterLinkOs createLinkOsPrinter(ZebraPrinter genericPrinter, LinkOsInformation info) throws ConnectionException
      Create a wrapper around a Zebra printer that provides access to Link-OS™ features. This method will query the printer for its control language, but will not query the printer for Link-OS™ information.
      Parameters:
      genericPrinter - An instance of a ZebraPrinter.
      info - Link-OS™ Information
      Returns:
      a Link-OS™ printer
      Throws:
      ConnectionException - if an I/O error occurs
    • createLinkOsPrinter

      public static ZebraPrinterLinkOs createLinkOsPrinter(ZebraPrinter genericPrinter, PrinterLanguage language) throws ConnectionException
      Create a wrapper around a Zebra printer that provides access to Link-OS™ features. This method will query the printer for its Link-OS™ information, but will not query the printer for its control language.
      Parameters:
      genericPrinter - An instance of a ZebraPrinter.
      language - The printer control language
      Returns:
      a Link-OS™ printer
      Throws:
      ConnectionException - if an I/O error occurs
    • createLinkOsPrinter

      public static ZebraPrinterLinkOs createLinkOsPrinter(ZebraPrinter genericPrinter, LinkOsInformation info, PrinterLanguage language) throws ConnectionException
      Create a wrapper around a Zebra printer that provides access to Link-OS™ features. This method will not query the printer for any information but will use the supplied info and language.
      Parameters:
      genericPrinter - An instance of a ZebraPrinter.
      info - Link-OS™ Information
      language - The printer control language
      Returns:
      a Link-OS™ printer
      Throws:
      ConnectionException - if an I/O error occurs
    • getLinkOsPrinter

      public static ZebraPrinterLinkOs getLinkOsPrinter(Connection connection) throws ConnectionException
      Create Link-OS™ Zebra printer from a connection that provides access to Link-OS™ features. This method will query the printer for its Link-OS™ version and its control language.
      Parameters:
      connection - an open connection to a Link-OS™ printer
      Returns:
      a Link-OS™ printer or null if the printer doesn't support Link-OS™ features
      Throws:
      ConnectionException - if an I/O error occurs
    • getLinkOsPrinter

      public static ZebraPrinterLinkOs getLinkOsPrinter(Connection connection, LinkOsInformation info) throws ConnectionException
      Create Link-OS™ Zebra printer from a connection that provides access to Link-OS™ features. This method will query the printer for its control language, but will not query the printer for Link-OS™ information.
      Parameters:
      connection - an open connection to a Link-OS™ printer
      info - Link-OS™ Information
      Returns:
      a Link-OS™ printer or null if the printer doesn't support Link-OS™ features
      Throws:
      ConnectionException - if an I/O error occurs
    • getLinkOsPrinter

      public static ZebraPrinterLinkOs getLinkOsPrinter(Connection connection, PrinterLanguage language) throws ConnectionException
      Create Link-OS™ Zebra printer from a connection that provides access to Link-OS™ features. This method will query the printer for its Link-OS™ information, but will not query the printer for its control language.
      Parameters:
      connection - an open connection to a Link-OS™ printer
      language - The printer control language
      Returns:
      a Link-OS™ printer or null if the printer doesn't support Link-OS™ features
      Throws:
      ConnectionException - if an I/O error occurs
    • getLinkOsPrinter

      public static ZebraPrinterLinkOs getLinkOsPrinter(Connection connection, LinkOsInformation info, PrinterLanguage language) throws ConnectionException
      Create Link-OS™ Zebra printer from a connection that provides access to Link-OS™ features. This method will not query the printer for any information but will use the supplied info and language.
      Parameters:
      connection - an open connection to a Link-OS™ printer
      info - Link-OS™ Information
      language - The printer control language
      Returns:
      a Link-OS™ printer or null if the printer doesn't support Link-OS™ features
      Throws:
      ConnectionException - if an I/O error occurs