Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
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.

Parameter and Runtime Settings Advanced Methods

Method Description
initRuntimeSettingsWithFile Initialize runtime settings with the settings in a given JSON file.
initRuntimeSettingsWithString Initialize runtime settings with the settings in a given JSON string.
appendTplFileToRuntimeSettings Append a new template file to the current runtime settings.
appendTplStringToRuntimeSettings Append a new template string to the current runtime settings.
allParameterTemplateNames Gets the parameter templates name array.
outputSettingsToFile Output runtime settings to a settings file (JSON file).
outputSettingsToString Output runtime settings to a string.
setModeArgument Sets the optional argument for a specified mode in Modes parameters.
getModeArgument Gets the optional argument for a specified mode in Modes parameters.

initRuntimeSettingsWithFile

Initialize runtime settings with the parameters obtained from a JSON file.

- (BOOL)initRuntimeSettingsWithFile:(NSString* _Nonnull)fileName
                       conflictMode:(EnumConflictMode)conflictMode
                              error:(NSError* _Nullable * _Nullable)error
                              NS_SWIFT_NAME(initRuntimeSettingsWithFile(_:conflictMode:));

Parameters

[in] fileName The settings file path.
[in] conflictMode The parameter setting mode, which decides whether to inherit parameters from previous template settings or to overwrite previous settings with the new template.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

  • Objective-C
  • Swift
  1. [barcodeReader initRuntimeSettingsWithFile:@"your template file path" conflictMode:EnumConflictModeOverwrite error:nil];
    
  2. try? barcodeReader.initRuntimeSettingsWithFile("your template file path", conflictMode:EnumConflictMode.overwrite)
    

initRuntimeSettingsWithString

Initialize runtime settings with the parameters obtained from a JSON string.

- (BOOL)initRuntimeSettingsWithString:(NSString* _Nonnull)content
                         conflictMode:(EnumConflictMode)conflictMode
                                error:(NSError* _Nullable * _Nullable)error
                                NS_SWIFT_NAME(initRuntimeSettingsWithString(_:conflictMode:));

Parameters

[in] content A JSON string that represents the content of the settings.
[in] conflictMode The parameter setting mode, which decides whether to inherit parameters from previous template setting or to overwrite previous settings with the new template.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

  • Objective-C
  • Swift
  1. [barcodeReader initRuntimeSettingsWithString:@"{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}" conflictMode:EnumConflictModeOverwrite error:nil];
    
  2. try? barcodeReader.initRuntimeSettingsWithString(content:"{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", conflictMode:EnumConflictMode.overwrite)
    

appendTplFileToRuntimeSettings

Append a new template file to the current runtime settings.

- (BOOL)appendTplFileToRuntimeSettings:(NSString * _Nonnull)fileName
                          conflictMode:(EnumConflictMode)conflictMode
                                 error:(NSError * _Nullable *_Nullable)error
                                 NS_SWIFT_NAME(appendTplFileToRuntimeSettings(_:conflictMode:));

Parameters

[in] fileName The settings file path.
[in] conflictMode The parameter setting mode, which decides whether to inherit parameters from previous template settings or to overwrite previous settings with the new template.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

  • Objective-C
  • Swift
  1. [barcodeReader appendTplFileToRuntimeSettings:@"your template file path" conflictMode:EnumConflictModeIgnore error:nil];
    
  2. try? barcodeReader.appendTplFileToRuntimeSettings(fileName:"your template file path", conflictMode:EnumConflictMode.ignore, error:&error)
    

appendTplStringToRuntimeSettings

Append a new template string to the current runtime settings.

- (BOOL)appendTplStringToRuntimeSettings:(NSString * _Nonnull)content
                            conflictMode:(EnumConflictMode)conflictMode
                                   error:(NSError *_Nullable *_Nullable)error   
                                   NS_SWIFT_NAME(appendTplStringToRuntimeSettings(_:conflictMode:));

Parameters

[in] content A JSON string that represents the content of the settings.
[in] conflictMode The parameter setting mode, which decides whether to inherit parameters from previous template setting or to overwrite previous settings with the new template.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

  • Objective-C
  • Swift
  1. [barcodeReader initRuntimeSettingsWithString:@"{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}" conflictMode:EnumConflictModeOverwrite error:nil];
    [barcodeReader appendTplStringToRuntimeSettings:@"{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_OneD\"], \"ExpectedBarcodesCount\":20}}" conflictMode:EnumConflictModeIgnore error:nil];
    
  2. try? barcodeReader.initRuntimeSettingsWithString(content:"{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", conflictMode:EnumConflictMode.Overwrite)
    try? barcodeReader.appendTplStringToRuntimeSettings(content:"{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_OneD\"], \"ExpectedBarcodesCount\":20}}", conflictMode:EnumConflictMode.ignore)
    

allParameterTemplateNames

Get count of parameter templates.

- (NSArray<NSString*>* _Nullable)allParameterTemplateNames: (NSError *__autoreleasing  _Nullable * _Nullable)error;

Parameters

[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

The template name array.

Code Snippet

  • Objective-C
  • Swift
  1. NSArray* allTplNames = [barcodeReader allParameterTemplateNames:nil];
    
  2. let allTplNames = try? barcodeReader.allParameterTemplateNames()
    

outputSettingsToFile

Outputs runtime settings and save them into a settings file (JSON file).

- (BOOL)outputSettingsToFile:(NSString *_Nullable)filePath 
                settingsName:(NSString*_Nonnull)settingsName 
                       error:(NSError*_Nullable *_Nullable)error   
                       NS_SWIFT_NAME(outputSettingsToFile(_:settingsName:));

Parameters

[in] filePath The path of the output file which stores current settings.
[in] settingsName A unique name for declaring current runtime settings.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

  • Objective-C
  • Swift
  1. settingsName = [barcodeReader outputSettingsToFile:@"your saving file path" settingsName:@"currentRuntimeSettings" error:nil];
    
  2. let settingsName = try? barcodeReader.outputSettingsToFile("your saving file path", settingsName:"currentRuntimeSettings")
    

outputSettingsToString

Output runtime settings to a string.

- (NSString *_Nullable)outputSettingsToString:(NSString*_Nonnull)settingsName 
                                        error:(NSError* _Nullable * _Nullable)error  
                                        NS_SWIFT_NAME(outputSettingsToString(_:));

Parameters

[in] settingsName A unique name for declaring current runtime settings.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

The output string which stores the content of current settings.

Code Snippet

  • Objective-C
  • Swift
  1. settingsName = [barcodeReader outputSettingsToString:@"currentRuntimeSettings" error:nil];
    
  2. let settingsName = try? barcodeReader.outputSettingsToString("currentRuntimeSettings")
    

setModeArgument

Sets the optional argument for a specified mode in Modes parameters.

- (BOOL)setModeArgument:(NSString* _Nonnull)modeName
                    index:(NSInteger)index 
                    argumentName:(NSString* _Nonnull)argumentName
                    argumentValue:(NSString* _Nonnull)argumentValue
                    error:(NSError* _Nullable * _Nullable)error;

Parameters

[in] modesName The mode parameter name to set argument.
[in] index The array index of mode parameter to indicate a specific mode.
[in] argumentName The name of the argument to set.
[in] argumentValue The value of the argument to set.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

  • Objective-C
  • Swift
  1. iPublicRuntimeSettings *settings = [barcodeReader getRuntimeSettings:nil];
    settings.binarizationModes = @[@(EnumBinarizationModeLocalBlock)];
    [barcodeReader updateRuntimeSettings:settings error:nil];
    [barcodeReader setModeArgument:@"BinarizationModes" index:0 argumentName:@"EnableFillBinaryVacancy" argumentValue:"1" error:nil];
    
  2. let settings = try? barcodeReader.getRuntimeSettings()
    settings!.binarizationModes = [EnumBinarizationMode.localBlock]
    try? barcodeReader.updateRuntimeSettings(settings!)
    try? barcodeReader.setModeArgument("BinarizationModes", index: 0, argumentName: "EnableFillBinaryVacancy", argumentValue: "1")
    

Remarks

Check follow link for available modes and arguments:

getModeArgument

Gets the optional argument for a specified mode in Modes parameters.

-(NSString* _Nonnull)getModeArgument:(NSString* _Nonnull)modeName
                               index:(NSInteger)index
                        argumentName:(NSString* _Nonnull)argumentName
                               error:(NSError* _Nullable * _Nullable)error;

Parameters

[in] modesName The mode parameter name to get arguments.
[in] index The array index of mode parameter to indicate a specific mode.
[in] argumentName The name of the argument to get.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

the optional argument for a specified mode

Code Snippet

  • Objective-C
  • Swift
  1. iPublicRuntimeSettings *settings = [barcodeReader getRuntimeSettings:nil];
    settings.binarizationModes = @[@(EnumBinarizationModeLocalBlock)];
    [barcodeReader updateRuntimeSettings:settings error:nil];
    [barcodeReader setModeArgument:@"BinarizationModes" index:0 argumentName:@"EnableFillBinaryVacancy" argumentValue:"1" error:nil];
    argumentValue = [barcodeReader getModeArgument:@"BinarizationModes" index:0 argumentName:@"EnableFillBinaryVacancy" error:&error];
    
  2. let settings = try? barcodeReader.getRuntimeSettings()
    settings?.binarizationModes![0] = EnumBinarizationMode.localBlock
    try? barcodeReader.updateRuntimeSettings(settings!)
    try? barcodeReader.setModeArgument("BinarizationModes", index: 0, argumentName: "EnableFillBinaryVacancy", argumentValue: "1")
    let argumentValue = barcodeReader.getModeArgument("BinarizationModes", index: 0, argumentName: "EnableFillBinaryVacancy", error: &error)
    

Remarks

Check follow link for available modes and arguments:

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 9.x
    • Version 9.2.13
    • Version 9.2.11
    • Version 9.2.10
    • Version 9.0.2
    • Version 9.0.1
    • Version 9.0.0
  • Version 8.x
    • Version 8.9.3
    • Version 8.9.0
    • Version 8.8.7
    • Version 8.8.5
    • Version 8.8.3
    • Version 8.8.0
    • Version 8.6.3
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.5
    • Version 8.2.3
    • Version 8.2.1
    • Version 8.2.0
    • Version 8.1.3
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +
© 2003–2022 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support