PrinterDetails

The Brady SDK PrinterDetails object is returned after attempting a connection to a printer. It holds all of the information about the printer that the user may need.

reconnect() async throws -> Bool

reconnect allows the user to reconnect to a recently disconnected printer. Returns a boolean that represents if the reconnect was successful. This method will only be successful if disconnectWithoutForget was called prior. Calling disconnect instead will forget the printer disabling the SDK from reconnecting.

disconnect() async throws -> Bool

disconnect allows the user to disconnect from the connected printer.

disconnectWithoutForget() async throws -> Bool

disconnectWithoutForget disconnects from the current printer without forgetting it internally allowing future auto-connects. Calling this immediately before PrinterDetails.forgetLastConnectedPrinter() will result in the same functionality as calling the normal "disconnect" method. Therefore, disconnectWithoutForget + forgetLastConnectedPrinter = disconnect.

print(template: Template, printingOptions: PrintingOptions, dontPrintTrailerFlag: Bool) async throws -> PrintingStatus

print allows the user to print a selected template to the connected printer using PrintingOptions to do so. Returns the PrintingStatus when finished.

  • template: The Template object that we want to print.
  • printingOptions: The PrintingOptions object that holds the information of how to print.
  • dontPrintTrailerFlag: A Boolean flag. Pass in false if the connected printer is not an M211.
    • If true, don't print a trailer on the end of a label during the print.
    • If false, print a trailer on the end of a label during the print.

print(image: UIImage, printingOptions: PrintingOptions, dontPrintTrailerFlag: Bool) async throws -> PrintingStatus

print allows the user to print a selected image file to the connected printer using PrintingOptions to do so. Returns the PrintingStatus when finished.

  • image: The UIImage object that we want to print.
  • printingOptions: The PrintingOptions object that holds the information of how to print.
  • dontPrintTrailerFlag: A Boolean flag. Pass in false if the connected printer is not an M211.
    • If true, don't print a trailer on the end of a label during the print.
    • If false, print a trailer on the end of a label during the print.

print(image: UIImage, imageWidth: Double, labelLength: Double, printingOptions: PrintingOptions, dontPrintTrailerFlag: Bool) async throws -> PrintingStatus

print allows the user to instead specify the width of the image and the length of the label in inches in order to print an image. The purpose of this method is to allow a user to resize how the image appears on the label if they are unhappy with the defaulted outcome. Returns the PrintingStatus when finished.

For example: This method is useful if the desired image to print is not square. Since the physical supply width cannot change, increasing the labelLength value might begin to eliminate wasted space on a label since the image will have more room to grow to fit. Vice versa, if the image does not entirely fit on a label, you may decrease the imageWidth value to shrink the image to fit on the label fully.

  • context: A Context object that represents a UI context
  • image: the image that we want to print.
  • imageWidth: allows the user to customize the width (in inches) of the image once it prints instead of using the default.
  • labelLength: allows the user to customize the length (in inches) of the label instead of using the default. Currently, M611 continuous supply have a length of 0.5 inches before being overrided according to the information we receive from the printer. The width (in inches) will always be stated on the physical supply.
  • printingOptions: the PrintingOptions object that holds the information of how to print.
  • dontPrintTrailerFlag: If true, don't print trailer white space after the printed label. If false, print one.

checkForSupplyMismatch(template: Template) throws -> Bool

checkForSupplyMismatch compares the supply in the connected printer to the supply used to create the template. Returns true if the supplies match, false if they are different. Can also throw errors.

  • template: The template object to compare.

getPrinterStatus() -> PrinterStatus

getPrinterStatus returns the PrinterStatus enumeration that describes the state of the printer's connection.

getPrinterName() -> String

getPrinterName returns a String that represents the name of the connected printer.

getPrinterModel() -> String

getPrinterModel returns a String that represents the model of the connected printer.

getConnectionType() -> ConnectionType

getConnectionType returns the ConnectionType enumeration that describes how we are connected to the printer.

getBatteryLevelPercentage() -> Int

getBatteryLevelPercentage returns an Integer that represents roughly the battery life percentage of the printer.

getIsAcConnected() -> Bool

getIsAcConnected returns a Boolean that represents whether this printer is plugged into an outlet and on AC power.

getPrinterStatusMessage -> String

getPrinterStatusMessage returns a String that represents the body of a printer error message.

getPrinterStatusRemedyExplanationMessage() -> String

getPrinterStatusRemedyExplanationMessage returns a String that represents the remedy to a printer error.

getPrinterStatusMessageTitle() -> String

getPrinterStatusMessageTitle returns a String that represents the title of the printer error.

getSupplyName() -> String

getSupplyName returns a String that represents the full name of the supply loaded in the connected printer.

getSupplyWidth() -> Double

getSupplyWidth returns a Double that represents the Width in inches of the supply installed in the printer.

getSupplyHeight() -> Double

getSupplyHeight return a Double that represents the Height in inches of the supply installed in the printer.

getSupplyRemainingPercentage() -> Int

getSupplyRemainingPercentage returns an Integer that represents the percentage of remaining supply in the connected printer.

getIsSupplyPreSized()

getIsSupplyPreSized() returns a Boolean that represents if the installed supply in the connected printer is a pre-sized supply. If false, the supply could be continuous or another supply not categorized as die-cut.

getSupplyDimensions() -> String

getSupplyDimensions returns a String that represents the supply dimensions (width and height).

getSupplyColor() -> CGColor

getSupplyColor returns a CGColor that represents the physical color of the label (supply tape) installed in the connected printer. This will be the background color of the printed out label.

getYNumber() -> String

getYNumber returns a String that represents the unique Y Number of the installed supply.

getRibbonName() -> String

getRibbonName returns a String that represents the ribbon installed in the printer (will return empty string if there is no ribbon). Only the M611 and M710 support ribbons.

getRibbonRemainingPercentage() -> String

getRibbonRemainingPercentage returns a String that represents the percentage of ribbon remaining in the connected printer (will return 0 if there is no ribbon). Only the M611 and M710 support ribbons.

getRibbonColor() -> CGColor

getRibbonColor returns a CGColor that represents the physical color of the Ribbon installed in the connected printer. This will be the color of everything printed on the label.

cutSupply() async throws -> Bool

cutSupply sends the cut printer operation to the printer to cut a label. This operation is asynchronous and returns a nullable Boolean representing if the operation was successful or not.

feedSupply() async throws -> Bool

feedSupply sends the feed operation to the printer to feed a label. This operation is asynchronous and returns a nullable Boolean representing if the operation was successful or not.

setAutomaticShutoffTime(timeInMinutes: Int) async throws -> Bool

setAutomaticShutoffTime sets the automatic shutdown time of the printer in minutes.

  • timeInMinutes: An Integer that represents the amount of minutes it takes for the connected printer to shut down automatically. If this is set to zero, it will not change the current value.