Label Definition
Defined in library scandit_datacapture_label
- LabelDefinition
class LabelDefinitionAdded in version 7.2.0
A configuration that defines labels and their relevant fields for Smart Label Capture to recognize and extract during scans. Label definitions provide flexible data extraction from specific label layouts without custom coding, enabling structured data extraction from diverse label types.
Label definitions support two primary approaches:
Pre-built Labels - Includes predefined configurations for common label types (price labels, VIN labels, 7-segment displays)
Custom Labels - Allows creating unique label definitions using custom barcode and text fields
Key configuration options for custom fields:
patterns - Regular expressions to identify target strings
dataTypePatterns - Context-identifying keywords for field recognition
symbologies - Specific barcode types to match
isOptional - Determines field requirement status
Pre-built field categories include:
Barcode Fields - Serial number, part number, IMEI
Price/Weight Fields - Unit price, total price, weight
Date/Text Fields - Packing date, expiry date
You can create label definitions in three ways:
Builder Pattern - Use LabelDefinitionBuilder for fluent configuration
Manual Construction - Create with explicit field lists creating a new LabelDefinition object and adding fields with addField() or addFields()
- LabelDefinition(name)
LabelDefinition(String name)
Added in version 7.2.0
Create a new label definition with the given name.
- fields
List<LabelFieldDefinition> get fields
Added in version 7.2.0
The fields of the label definition.
- builder()
static LabelDefinitionBuilder builder()
Added in version 7.2.0
Create a new label definition builder.
- addField(field)
voidaddField(LabelFieldDefinition field)Added in version 7.2.0
Add a field to the label definition.
- addFields(fields)
voidaddFields(List<LabelFieldDefinition> fields)Added in version 7.2.0
Add multiple fields to the label definition.