Label Definition Builder
Defined under the namespace Scandit.Datacapture.Label
- LabelDefinitionBuilder
class LabelDefinitionBuilderAdded in version 7.2.0
A fluent builder class for creating LabelDefinition objects with a convenient, chainable interface. This builder provides methods to add various field types (barcodes, text fields, dates) and configure their properties in a structured manner.
The LabelDefinitionBuilder enables you to construct complex label definitions by adding multiple field types:
Barcode Fields - Serial numbers, part numbers, IMEI codes, custom barcodes
Text Fields - Unit prices, total prices, weight information, custom text, date fields (for example, packing dates, expiry dates with configurable formats)
Each field can be configured with validation regexes, optional status, and symbology settings where applicable. The builder pattern ensures type safety and provides a clear, readable way to define label structures.
Note
This builder is the recommended approach for creating label definitions as it provides better type safety and readability compared to manual construction.
- addSerialNumberBarcode(barcode)
addSerialNumberBarcode(barcode: SerialNumberBarcode):
thisAdded in version 7.2.0
Adds a pre-configured serial number barcode field to the label definition.
- addPartNumberBarcode(barcode)
addPartNumberBarcode(barcode: PartNumberBarcode):
thisAdded in version 7.2.0
Adds a pre-configured part number barcode field to the label definition.
- addImeiOneBarcode(barcode)
addImeiOneBarcode(barcode: ImeiOneBarcode):
thisAdded in version 7.2.0
Adds a pre-configured IMEI-1 barcode field to the label definition.
- addImeiTwoBarcode(barcode)
addImeiTwoBarcode(barcode: ImeiTwoBarcode):
thisAdded in version 7.2.0
Adds a pre-configured IMEI-2 barcode field to the label definition.
- addCustomBarcode(barcode)
addCustomBarcode(barcode: CustomBarcode):
thisAdded in version 7.2.0
Adds a pre-configured custom barcode field to the label definition.
- addUnitPriceText(text)
addUnitPriceText(text: UnitPriceText):
thisAdded in version 7.2.0
Adds a pre-configured unit price text field to the label definition.
- addTotalPriceText(text)
addTotalPriceText(text: TotalPriceText):
thisAdded in version 7.2.0
Adds a pre-configured total price text field to the label definition.
- addWeightText(text)
addWeightText(text: WeightText):
thisAdded in version 7.2.0
Adds a pre-configured weight text field to the label definition.
- addPackingDateText(text)
addPackingDateText(text: PackingDateText):
thisAdded in version 7.2.0
Adds a pre-configured packing date text field to the label definition.
- adaptiveRecognitionMode(mode)
adaptiveRecognitionMode(mode: AdaptiveRecognitionMode):
thisAdded in version 8.0.0
Sets the adaptive recognition mode for the label definition being built. Controls whether cloud-based processing is used as a backup for on-device processing. See AdaptiveRecognitionMode for available options.
- addExpiryDateText(text)
addExpiryDateText(text: ExpiryDateText):
thisAdded in version 7.2.0
Adds a pre-configured expiry date text field to the label definition.
- addDateText(text)
addDateText(text: DateText):
thisAdded in version 8.0.0
Adds a pre-configured date text field to the label definition.
- addCustomText(text)
addCustomText(text: CustomText):
thisAdded in version 7.2.0
Adds a pre-configured custom text field to the label definition.
- setHiddenProperty(key, value)
setHiddenProperty(key: string, value:
unknown):thisAdded in version 7.2.0
Sets a hidden property to be used when creating the LabelDefinition object.
- setHiddenProperties(hiddenProperties)
setHiddenProperties(hiddenProperties: Record<string,
unknown>):thisAdded in version 7.2.0
Sets hidden properties to be used when creating the LabelDefinition object.
- build(name)
build(name: string): Promise<LabelDefinition>
Added in version 7.2.0
Builds the LabelDefinition object with the given name.