Configure Barcode Symbologies
This page describes the steps to configure a barcode based capture mode to read only the specific barcodes you require.
When integrating Scandit barcode scanning into your application, you must configure the type(s) of barcodes that you need to scan. Generally, it is best to enable only those symbologies you need, as this ensures the best performance and user experience. No symbologies are enabled by default, to enable scanning of a particular barcode, its symbology must be enabled.
If you are unsure what symbologies you need to scan, use the Scandit Demo App available in the Apple App Store and Android Play Store. After you have installed the app, select the “Any Code” mode and scan the codes you are interested in. The name of the symbology appears on the result screen.
See the Barcode Symbologies page for all supported barcode types. Additionally, the available symbol count range, checksum, extensions, etc., for all symbologies are listed in Symbology Properties.
Enable the Symbologies You Want to Read
For you app to read a given type of symbology, you need to enable it in the capture settings of the barcode capture mode you are using. For example:
SparkScanSettings.SparkScanSettings()
for SparkScanBarcodeCaptureSettings.enableSymbology()
for barcode captureBarcodeBatchSettings.enableSymbology()
for barcode batch (MatrixScan)
The following code shows how to enable scanning Code 128 codes for Barcode Capture:
const settings = new BarcodeCaptureSettings();
settings.enableSymbology(Symbology.Code128, true);
Symbology Presets by Industry
The capture settings presets in this section are currently only available for single scanning modes (Barcode Capture, SparkScan) and are not available for MatrixScan.
An alternative to enabling your desired symbologies individually in your capture settings, you can use a predefined industry vertical CapturePreset
.
The available presets and the corresponding symbologies enabled by each is listed below.
You can still enable or disable individual symbologies as needed after creating your capture settings using one the presents.
Preset | Symbologies Enabled |
---|---|
TRANSPORT | Code128 QR Codes Code 39 Data Matrix EAN13_UPCA Interleaved 2-of-5 Aztec EAN8 PDF417 UPCE |
LOGISTICS | Code128 QR Codes Code 39 Data Matrix EAN13_UPCA Interleaved 2-of-5 Codabar EAN8 PDF417 UPCE |
RETAIL | EAN13_UPCA Code128 QR Codes Code 39 EAN8 Data Matrix Interleaved 2-of-5 UPCE GS1 Databar GS1 Databar Expanded |
HEALTHCARE | Code128 Data Matrix QR Code EAN13_UPCA Code39 MicroPDF417 Interleaved 2-of-5 MSI Plessey EAN8 |
MANUFACTURING | Code128 Data Matrix Code 39 QR Codes EAN13_UPCA Interleaved 2-of-5 PDF417 UPCE EAN8 |
Configure the Active Symbol Count
Barcode symbologies (such as Code 128, Code 39, Code 93, or Interleaved Two of Five) can store variable-length data. For example, Code 39 can be used to store a string from 1 to 40-50 symbols. There is no fixed upper limit, though there are practical limitations to the code’s length for it to still be conveniently readable by barcode scanners.
For performance reasons, the Scandit Data Capture SDK limits the possible symbol range for variable-length symbologies.
If you want to read codes that are shorter/longer than the specified default range or you want to tailor your app to only read codes of a certain length, you need to change the active symbol count of the symbology to accommodate the data length you want to use in your application.
The below lines of code show how to change the active symbol count for Code 128 to read codes with 6, 7 and 8 symbols.
const settings = new BarcodeCaptureSettings();
const symbologySettings = settings.settingsForSymbology(Symbology.Code128);
symbologySettings.activeSymbolCounts = [6, 7, 8];
How to Calculate the Active Symbol Count
Calculating the active symbol count is symbology-specific as each symbology has a different symbol definition. To understand what a symbology’s default active symbol count range is and to learn how to compute the active symbol count for a particular symbology, see symbology properties.
As an alternative, you can also use the Scandit Demo App (linked above). After you have installed the app and scanned the codes you are interested in, the active symbol count appears on the result screen.
Read Bright-on-Dark Barcodes
Most barcodes are printed using dark ink on a bright background. Some symbologies allow the colors to be inverted and can also be printed using bright ink on a dark background.
This is not possible for all symbologies as it could lead to false reads when the symbology is not designed for this use case. See symbology properties to learn which symbologies allow color inversion.
When you enable a symbology as described above, only dark-on-bright codes are enabled (see SymbologySettings.isEnabled). When you also want to read bright-on-dark codes, color-inverted reading for that symbology must also be enabled (see SymbologySettings.isColorInvertedEnabled):
const settings = new BarcodeCaptureSettings();
const symbologySettings = settings.settingsForSymbology(Symbology.Code128);
symbologySettings.isColorInvertedEnabled = true;
Enforce Checksums
Some symbologies have a mandatory checksum that will always be enforced while others only have optional checksums. Enforcing an optional checksum will reduce false positives as an additional check can be performed.
When enabling a checksum you have to make sure that the data of your codes contains the calculated checksum otherwise the codes get discarded as the checksum doesn’t match. All available checksums per symbology can be found in symbology properties.
You can enforce a specific checksum by setting it through SymbologySettings.checksums:
const settings = new BarcodeCaptureSettings();
const symbologySettings = settings.settingsForSymbology(Symbology.Code39);
symbologySettings.checksums = [Checksum.Mod43];
Enable Symbology-Specific Extensions
Some symbologies allow further configuration. These configuration options are available as symbology extensions that can be enabled/disabled for each symbology individually.
Some extensions affect how the data in the code is formatted, others allow for more relaxed recognition modes that are disabled by default to eliminate false reads. All available extensions per symbology and a description of what they do can be found in the documentation on symbology properties.
To enable/disable a symbology extension, use SymbologySettings.setExtensionEnabled().
The following code shows how to enable the full ASCII extension for Code 39.
const settings = new BarcodeCaptureSettings();
const symbologySettings = settings.settingsForSymbology(Symbology.Code39);
symbologySettings.setExtensionEnabled('full_ascii', true);
This extension allows Code 39 to encode all 128 ASCII characters instead of only the 43 characters defined in the standard. The extension is disabled by default as it can lead to false reads when enabled.