Custom Barcode

Defined in library scandit_datacapture_label

CustomBarcode
class CustomBarcode : BarcodeField

Added in version 7.2.0

Defines a barcode field with customizable symbology support and validation regexes. This field type allows you to specify which barcode symbologies should be recognized and optionally apply data validation regexes to the decoded content.

Use the builder pattern with CustomBarcodeBuilder for convenient configuration, or create instances directly using the various factory methods.

CustomBarcode.initWithNameAndSymbologySettings(name, symbologySettings)
factory CustomBarcode.initWithNameAndSymbologySettings(
        String name,
        List<SymbologySettings> symbologySettings)

Added in version 7.2.0

Create a new custom barcode field definition with the given name and symbology settings.

CustomBarcode.initWithNameAndSymbologies(name, symbologies)
factory CustomBarcode.initWithNameAndSymbologies(
        String name,
        Set<Symbology> symbologies)

Added in version 7.2.0

Create a new custom barcode field definition with the given name and supported symbologies.

CustomBarcode.initWithNameAndSymbology(name, symbology)
factory CustomBarcode.initWithNameAndSymbology(
        String name,
        Symbology symbology)

Added in version 7.2.0

Create a new custom barcode field definition with the given name and symbology settings.

setLocationWithRect(rect)
void setLocationWithRect(Rect rect)

Added in version 7.2.0

Set the location of the barcode field using a rectangle.

setLocationWithCoordinates(left, top, right, bottom)
void setLocationWithCoordinates(double left,
        double top,
        double right,
        double bottom)

Added in version 7.2.0

Set the location of the barcode field using coordinates.

setLocationWithType(location)
void setLocationWithType(LabelFieldLocationType location)

Added in version 7.2.0

Set the location of the barcode field using a predefined location type.

anchorRegexes
List<String> get anchorRegexes

Added in version 8.0.0

Context-identifying keywords or phrases used to distinguish between fields that may have similar patterns. These patterns help Smart Label Capture identify which field the captured data belongs to when multiple fields could match the same regex.

For example, when a label contains both expiry date and packing date fields, you can use anchorRegexes like [“exp”, “expiry”] for the expiry date field and [“pack”, “packing”] for the packing date field to help the system correctly identify which date is which.

name
String get name

Added in version 7.2.0

The name of the barcode field.

valueRegexes
List<String> get valueRegexes

Added in version 8.0.0

Regular expressions used to validate the decoded barcode content. These patterns allow you to ensure that the captured barcode data matches the expected format for your specific use case.

For example, you can use regexes like [“^[0-9]{12,13}$”] to ensure the barcode contains only 12-13 digits, or [“^[A-Z0-9]{17}$”] for VIN codes that must be exactly 17 alphanumeric characters.

isOptional
bool get isOptional

Added in version 7.2.0

Determines whether this field is required for the label to be considered complete. When set to true, the label can be marked as complete even if this field is not found. When false (mandatory), the label will only be complete when this field is successfully captured.

Optional fields are useful for scenarios where certain information might not always be present on labels, such as promotional codes or secondary identifiers.

symbologies
List<SymbologySettings> get symbologies

Added in version 7.2.0

The barcode symbologies (formats) that this field should recognize. This allows you to specify which types of barcodes are expected for this field, such as Code 128, EAN-13, or Data Matrix.

Restricting symbologies improves recognition accuracy and performance by focusing the scanner on the expected barcode formats for each field.

location
LabelFieldLocation? get location

Added in version 7.2.0

The spatial location constraint for this barcode field within the label. This can be used to specify where on the label this field is expected to appear, helping to improve recognition accuracy and speed by focusing the search area.