Label Definition
Defined in namespace Scandit.DataCapture.Label
- LabelDefinition
class LabelDefinitionAdded in version 7.5.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
Factory Methods - Use predefined definitions like CreatePriceCaptureDefinition() for common use cases
Manual Construction - Create with explicit field lists using Create()
- Create()
static LabelDefinition Create(
stringname, IList<ILabelFieldDefinition> fields)Added in version 7.5.0
Create a new label definition with the given name and fields.
- Name
stringName { get; }Added in version 7.5.0
The name of the label definition.
- Fields
IList<ILabelFieldDefinition> Fields { get; }
Added in version 7.5.0
The fields of the label definition.
- CreateVinLabelDefinition()
static LabelDefinition CreateVinLabelDefinition(
stringname)Added in version 7.5.0
Creates a predefined label definition for scanning Vehicle Identification Numbers (VIN). VIN codes are 17-character alphanumeric serial numbers that can appear as either text or barcodes on vehicles.
This factory method returns a label definition with two optional fields:
text - An optional text field for scanning VIN codes in text format with pattern
[A-Z0-9]{17}barcode - An optional barcode field for scanning VIN codes in barcode format (QR, Code 39, or Data Matrix symbologies) with pattern
[A-Z0-9]{17}
- CreatePriceCaptureDefinition()
static LabelDefinition CreatePriceCaptureDefinition(
stringname)Added in version 7.5.0
Creates a predefined label definition for scanning price labels on retail products. This factory method is designed for price checking scenarios where both barcode and price text need to be captured from product labels.
This factory method returns a label definition with two fields:
SKU - A mandatory barcode field for scanning Symbology.Ean13Upca and Symbology.Code128.
priceText - An optional text field for scanning price text using specialized price label recognition with pattern
\\d+.
You can easily disable one of the symbologies of the barcode field by changing global mode settings. For example, to disable Symbology.Code128 one can do this:
Note
To use this label definition, make sure to import the PriceCapture library.
- Builder()
static LabelDefinitionBuilder Builder()
Added in version 7.5.0
Create a new label definition builder.