Label Definition Builder
Defined under the namespace Scandit.Datacapture.Label
- LabelDefinitionBuilder
class LabelDefinitionBuilder
Added 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 patterns, 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):
this
Added in version 7.2.0
Adds a pre-configured serial number barcode field to the label definition.
- addPartNumberBarcode(barcode)
addPartNumberBarcode(barcode: PartNumberBarcode):
this
Added in version 7.2.0
Adds a pre-configured part number barcode field to the label definition.
- addImeiOneBarcode(barcode)
addImeiOneBarcode(barcode: ImeiOneBarcode):
this
Added in version 7.2.0
Adds a pre-configured IMEI-1 barcode field to the label definition.
- addImeiTwoBarcode(barcode)
addImeiTwoBarcode(barcode: ImeiTwoBarcode):
this
Added in version 7.2.0
Adds a pre-configured IMEI-2 barcode field to the label definition.
- addCustomBarcode(barcode)
addCustomBarcode(barcode: CustomBarcode):
this
Added in version 7.2.0
Adds a pre-configured custom barcode field to the label definition.
- addUnitPriceText(text)
addUnitPriceText(text: UnitPriceText):
this
Added in version 7.2.0
Adds a pre-configured unit price text field to the label definition.
- addTotalPriceText(text)
addTotalPriceText(text: TotalPriceText):
this
Added in version 7.2.0
Adds a pre-configured total price text field to the label definition.
- addWeightText(text)
addWeightText(text: WeightText):
this
Added in version 7.2.0
Adds a pre-configured weight text field to the label definition.
- addPackingDateText(text)
addPackingDateText(text: PackingDateText):
this
Added in version 7.2.0
Adds a pre-configured packing date text field to the label definition.
- addExpiryDateText(text)
addExpiryDateText(text: ExpiryDateText):
this
Added in version 7.2.0
Adds a pre-configured expiry date text field to the label definition.
- addCustomText(text)
addCustomText(text: CustomText):
this
Added in version 7.2.0
Adds a pre-configured custom text field to the label definition.
- setHiddenProperty(key, value)
setHiddenProperty(key: string, value:
unknown
):this
Added in version 7.2.0
Sets a hidden property to be used when creating the LabelDefinition object.
- setHiddenProperties(hiddenProperties)
setHiddenProperties(hiddenProperties: Record<string,
unknown
>):this
Added 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.