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()
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(int labelNumber, double dpi, double maxPixelWidthAndHeight)
getPreview returns a Bitmap object of the chosen template. To set the Bitmap to our UI, we could then call something like:
ImageView.setImageBitmap(Template.getPreview(0, 96, Math.min(ImageView.getWidth(), ImageView.getHeight()));
-
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()
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.
storeFonts(Context context, int[] fontList)
Stores a list of resource ID's that represent font files that can be used later if a template was designed to use one of them.
Example: A template was designed with a text object whose font is "brady_fixed_width.ttf". This font file can be placed in an Android app's "res/font/" directory and then initialized like: "int[] fontList = new int[]{R.font.brady_fixed_width};"
- context is the Context of the current Activity
- fontList a list of int that represent font file resource ID's