Resource Base
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.

How to set the barcode format and the number of barcodes expected to be detected

DBR can handle various common barcode formats on the market and is well suited to supporting multi-code scenes on an image. In order to support all barcode formats and solve all codes appearing in the figure, it will consume a certain amount of time. If you don’t want to consume extra time, you can set the required barcode format through BarcodeFormatIds, BarcodeFormatIds_2, and set the number of barcodes expected to be detected through ExpectedBarcodesCount.


These two parameters are used to set the required barcode format to be decoded. Barcode formats not specified will not be processed. You can speed up DBR processing by eliminating barcode formats that you don’t care about. For specific enumeration values for the parameters, please refer to our API documents BarcodeFormatIds, BarcodeFormatIds_2.


This parameter is used to set the number of barcodes expected to be detected for each image. When the number of detected barcodes is greater than or equal to this parameter, the DBR algorithm will terminate. DBR can handle scenes with multiple barcodes in one image. Using this setting to specify the expected number of barcodes to read you can save time once the expected number of reads have occurred.


The following demonstrates the two configuration methods of RuntimeSetting and JSON template

CBarcodeReader* reader = new CBarcodeReader();   
reader->InitLicense("enter your license");  
PublicRuntimeSettings* runtimeSettings = new PublicRuntimeSettings();   
reader->GetRuntimeSettings(runtimeSettings); //get runtime settings 
runtimeSettings->barcodeFormatIds = BF_ALL; //set barcode format. BF_ALL means all barcode formats   
runtimeSettings->barcodeFormatIds_2 = BF2_NULL; //set barcode format2   
runtimeSettings->expectedBarcodesCount = 1; //set the number of barcodes expected to be detected to 1  
char sError[512];   
reader->UpdateRuntimeSettings(runtimeSettings, sError, 512); //update runtime settings 
reader->DecodeFile("file path", ""); //decode  
TextResultArray* paryResult = NULL;   
reader->GetAllTextResults(&paryResult); //get decode result 
delete runtimeSettings;   
delete reader;  

This page is compatible for:

Version 7.5

Is this page helpful?

YesYes NoNo

latest version

  • Latest Version
  • version 8.1.2
  • version 8.0
  • version 7.6
  • version 7.5
Change +
© 2003–2020 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support