Template

  • The Brady SDK Template object allows the user to:
    • Retrieve a list of a .BWT file's data.
    • Retrieve a Bitmap of the template used to preview the template in a UI.
    • Retrieve the name of the .BWT file's label part.

getTemplateData() throws -> [TemplateObjectData]

getTemplateData returns a list of TemplateObjectData that the user may iterate through. This will hold information about the physical elements and objects on a Brady Workstation Template. (Reference TemplateObjectData)

getPreview(labelNumber: Int, dpi: Double, maxPixelWidthAndHeight: Double, printerDetails: PrinterDetails?) throws -> CGImage

getPreview returns a CGImage object (similar to Bitmap) of the chosen template. To set the CGImage to our UI, we could then call something like:

Image(uiImage: UIImage(cgImage: template?.getPreview(labelNumber: 1, dpi: 96, maxPixelWidthAndHeight: 200)!, printerDetails: nil)).resizable()
  • labelNumber: an Integer that represents which label in the print job to get a preview of. (Currently we only support 1 print job at a time so this will always be 0).

  • dpi: a Double that represents the preview's "Dots Per Inch". This is usually 96 for most phones.

  • maxPixelWidthAndHeight: a Double that represents the dimension with the highest value. (See example above).

  • printerDetails: a PrinterDetails object that represents all information about the printer the mobile device is currently connected to. If nil, the preview will not reflect an accurate print preview. If not nil, the preview will reflect the color of the label supply and ribbon color.

getSupplyName() throws -> String

getSupplyName returns a String representing the name of the template's label part. In Brady Workstation, when we design a template, we always have to set a specific part. This could be useful information when validating a templates part or when comparing a connected printer's part.