Custom Barcode
Defined in package com.scandit.datacapture.label
- CustomBarcode
class CustomBarcode : BarcodeField
Added in version 6.21.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.
- anchorRegexes
@NonNull List<@NonNull String> getAnchorRegexes()
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.
- valueRegexes
@NonNull List<@NonNull String> getValueRegexes()
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
booleanisOptional()Added in version 6.21.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.
- numberOfMandatoryInstances
@Nullable Integer getNumberOfMandatoryInstances()
Added in version 7.6.0
The minimum number of instances of this field that must be captured for the label to be considered complete. This is useful for fields that may appear multiple times on a label, such as multiple serial numbers or repeated information.
- symbologies
@NonNull List<@NonNull SymbologySettings> getSymbologies()
Added in version 6.21.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
@Nullable LabelFieldLocation getLocation()
Added in version 6.21.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.