Dev Center
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

Specify Barcode Formats and Count

Set Barcode Formats

Specifying the barcode format is always the first step when it comes to the configuration of DBR. Be sure to confirm that the target barcode formats are indeed supported by DBR by checking our list of supported barcode types. Excluding undesired barcode types will improve the processing efficiency. Generally, the barcode format settings are updated via PublicRuntimeSettings class by specifying enumeration member of BarcodeFormat or BarcodeFormat_2.

  • JavaScript
  • Android
  • Objective-C
  • Swift
  • Python
  • Java
  • C#
  • C++
  • C
// Obtain current runtime settings of `reader` instance.
let settings = await scanner.getRuntimeSettings();
// Specify the barcode formats by enumeration values.
// There are two enumerations storing all supported barcode formats and each one needs to be set individually.
// Use "|" to enable multiple barcode formats at one time.
settings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED | Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE;
settings.barcodeFormatIds_2 = Dynamsoft.DBR.EnumBarcodeFormat_2.BF2_POSTALCODE;
// Update the settings.
await scanner.updateRuntimeSettings(settings);
// Obtain current runtime settings of `reader` instance.
PublicRuntimeSettings settings = reader.getRuntimeSettings();
// Specify the barcode formats by enumeration values.
// There are two enumerations storing all supported barcode formats and each one needs to be set individually.
// Use "|" to enable multiple barcode formats at one time.
settings.barcodeFormatIds = EnumBarcodeFormat.BF_QR_CODE | EnumBarcodeFormat.BF_ONED;
settings.barcodeFormatIds_2 = EnumBarcodeFormat_2.BF2_POSTALCODE;
// Update the settings.
reader.updateRuntimeSettings(settings);
NSError* err = nil;
// Obtain current runtime settings of `reader` instance.
iPublicRuntimeSettings* settings = [reader getRuntimeSettings:&err];
// Specify the barcode formats by enumeration values.
// There are two enumerations storing all supported barcode formats and each one needs to be set individually.
// Use "|" to enable multiple barcode formats at one time.
settings.barcodeFormatIds = EnumBarcodeFormatQRCODE | EnumBarcodeFormatONED;
settings.barcodeFormatIds_2 = EnumBarcodeFormat2POSTALCODE;
// Update the settings.
[reader updateRuntimeSettings:settings error:&err];
// Obtain current runtime settings of `barcodeReader` instance.
let settings = try? barcodeReader.getRuntimeSettings()
// Specify the barcode formats by enumeration values.
// There are two enumerations storing all supported barcode formats and each one needs to be set individually.
// Use "|" to enable multiple barcode formats at one time.
settings?.barcodeFormatIds = EnumBarcodeFormat.ONED.rawValue | EnumBarcodeFormat.QRCODE.rawValue
settings?.barcodeFormatIds_2 = EnumBarcodeFormat2.POSTALCODE.rawValue
// Update the settings.
try? barcodeReader.updateRuntimeSettings(settings!)
# Obtain current runtime settings of `reader` instance.
settings = reader.get_runtime_settings()
# Specify the barcode formats by enumeration values.
# There are two enumerations storing all supported barcode formats and each one needs to be set individually.
# Use "|" to enable multiple barcode formats at one time.
settings.barcode_format_ids = EnumBarcodeFormat.BF_ONED | EnumBarcodeFormat.BF_QR_CODE
settings.barcode_format_ids_2 = EnumBarcodeFormat_2.BF2_POSTALCODE
# Update the settings.
reader.update_runtime_settings(settings)
// Obtain current runtime settings of `reader` instance.
PublicRuntimeSettings settings = reader.getRuntimeSettings();
// Specify the barcode formats by enumeration values.
// There are two enumerations storing all supported barcode formats and each one needs to be set individually.
// Use "|" to enable multiple barcode formats at one time.
settings.barcodeFormatIds = EnumBarcodeFormat.BF_ONED | EnumBarcodeFormat.BF_QR_CODE;
settings.barcodeFormatIds_2 = EnumBarcodeFormat_2.BF2_POSTALCODE;
// Update the settings.
reader.updateRuntimeSettings(settings);
// Obtain current runtime settings of `reader` instance.
PublicRuntimeSettings settings = reader.GetRuntimeSettings();
// Specify the barcode formats by enumeration values.
// There are two enumerations storing all supported barcode formats and each one needs to be set individually.
// Use "|" to enable multiple barcode formats at one time.
settings.BarcodeFormatIds = (int)(EnumBarcodeFormat.BF_QR_CODE | EnumBarcodeFormat.BF_ONED);
settings.BarcodeFormatIds_2 = (int)(EnumBarcodeFormat_2.BF2_POSTALCODE);
// Update the settings.
reader.UpdateRuntimeSettings(settings);
PublicRuntimeSettings settings;
char szErrorMsg[256] = {0};
// Obtain current runtime settings of `reader` instance.
reader.GetRuntimeSettings(&settings);
// Specify the barcode formats by enumeration values.
// There are two enumerations storing all supported barcode formats and each one needs to be set individually.
// Use "|" to enable multiple barcode formats at one time.
settings.barcodeFormatIds = BF_QR_CODE | BF_ONED;
settings.barcodeFormatIds_2 = BF2_POSTALCODE;
// Update the settings.
reader.UpdateRuntimeSettings(&settings, szErrorMsg, 256);
PublicRuntimeSettings settings;
char szErrorMsg[256] = {0};
// Obtain current runtime settings of `reader` instance.
DBR_GetRuntimeSettings(reader, &settings);
// Specify the barcode formats by enumeration values.
// There are two enumerations storing all supported barcode formats and each one needs to be set individually.
// Use "|" to enable multiple barcode formats at one time.
settings.barcodeFormatIds = BF_QR_CODE | BF_ONED;
settings.barcodeFormatIds_2 = BF2_POSTALCODE;
// Update the settings.
DBR_UpdateRuntimeSettings(reader, &settings, szErrorMsg, 256);

Set Barcode Count

The expectedBarcodeCount parameter controls the number of expected results of the recognized barcodes via barcode reader from a single image. The process will be stopped as soon as the count of successfully decoded barcodes reaches the expected amount.

There are some suggestions on how to set the expectedBarcodeCount:

  • When your project is designed for decoding a single barcode per image or frame, the recommended expectedBarcodeCount is 1. This will sharply improve the processing speed.
  • When there are n barcodes in a single image or frame (n is a fixed number) and you’d like the barcode reader to decode all of them, the recommended expectedBarcodeCount is n.
  • When the number of barcodes is unknown and you want to output as many barcode results as possible, you can set the expectedBarcodeCount to the maximum possible value of expectedBarcodeCount.
  • When the number of barcodes is unknown and you want to output at least one barcode result as soon as possible, you can set the expectedBarcodeCount to 0. The barcode reader will try to decode at least one barcode from the image.
  • JavaScript
  • Android
  • Objective-C
  • Swift
  • Python
  • Java
  • C#
  • C++
  • C
// Obtain current runtime settings of `reader` instance.
let settings = await scanner.getRuntimeSettings();
// Set the expected barcode count
settings.expectedBarcodesCount = 0;
// Update the settings.
await scanner.updateRuntimeSettings(settings);
// Obtain current runtime settings of `reader` instance.
PublicRuntimeSettings settings = reader.getRuntimeSettings();
// Set the expected barcode count
settings.expectedBarcodesCount = 0;
// Update the settings.
reader.updateRuntimeSettings(settings);
NSError* err = nil;
// Obtain current runtime settings of `reader` instance.
iPublicRuntimeSettings* settings = [reader getRuntimeSettings:&err];
// Set the expected barcode count
settings.expectedBarcodesCount = 0;
// Update the settings.
[reader updateRuntimeSettings:settings error:&err];
// Obtain current runtime settings of `barcodeReader` instance.
let settings = try? barcodeReader.getRuntimeSettings()
// Set the expected barcode count
settings.expectedBarcodesCount = 0
// Update the settings.
try? barcodeReader.updateRuntimeSettings(settings!)
# Obtain current runtime settings of `reader` instance.
settings = reader.get_runtime_settings()
# Set the expected barcode count
settings.expected_barcodes_count = 0;
# Update the settings.
reader.update_runtime_settings(settings)
// Obtain current runtime settings of `reader` instance.
PublicRuntimeSettings settings = reader.getRuntimeSettings();
// Set the expected barcode count
settings.expectedBarcodesCount = 0;
// Update the settings.
reader.updateRuntimeSettings(settings);
// Obtain current runtime settings of `reader` instance.
PublicRuntimeSettings settings = reader.GetRuntimeSettings();
// Set the expected barcode count
settings.ExpectedBarcodesCount = 0;
// Update the settings.
reader.UpdateRuntimeSettings(settings);
PublicRuntimeSettings settings;
char szErrorMsg[256] = {0};
// Obtain current runtime settings of `reader` instance.
reader.GetRuntimeSettings(&settings);
// Set the expected barcode count
settings.expectedBarcodesCount = 0;
// Update the settings.
reader.UpdateRuntimeSettings(&settings, szErrorMsg, 256);
PublicRuntimeSettings settings;
char szErrorMsg[256] = {0};
// Obtain current runtime settings of `reader` instance.
DBR_GetRuntimeSettings(reader, &settings);
// Set the expected barcode count
settings.expectedBarcodesCount = 0;
// Update the settings.
DBR_UpdateRuntimeSettings(reader, &settings, szErrorMsg, 256);

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

version 9.6.42

  • Latest version
  • Version 10.x
    • Version 10.2.0
    • Version 10.0.21
    • Version 10.0.20
    • Version 10.0.10
    • Version 10.0.0
  • Version 9.x
    • Version 9.6.42
    • Version 9.6.40
    • Version 9.6.33
    • Version 9.6.32
    • Version 9.6.31
    • Version 9.6.30
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.0
    • Version 9.0.0
  • Version 8.x
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +