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) 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)!)).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).
getPartInfo() -> String
getPartInfo 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.