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.

Basic Settings Methods

Method Description
set_mode_argument Sets the optional argument for a specified mode in Modes parameters.
get_mode_argument Gets the optional argument for a specified mode in Modes parameters.
get_runtime_settings Gets current runtime settings.
update_runtime_settings Updates runtime settings with a given struct.
reset_runtime_settings Resets all parameters to default values.

set_mode_argument

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

BarcodeReader.set_mode_argument(modes_name, index, argument_name, argument_value)

Parameters

[in] modes_name <*str*> : The mode(s) parameter name to set argument.
[in] index <*int*> : The array index of modes parameter to indicate a specific mode.
[in] argument_name <*str*> : The name of the argument to set.
[in] argument_value <*str*> : The value of the argument to set.

Return Value

error <*tuple*> : error_code = error[0], error_message = error[1], if error_code != EnumErrorCode.DBR_OK, you can get the detailed error message by error_message.

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
settings.binarization_modes[0] = EnumBinarizationMode.BM_LOCAL_BLOCK

try:
    reader.update_runtime_settings(settings)
    error = reader.set_mode_argument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1")
    if error[0] != 0:
        print(error[1])
except BarcodeReaderError as e:
    print(e)

Remarks
Check the available modes and arguments below:

get_mode_argument

Gets argument value for the specified mode parameter.

BarcodeReader.get_mode_argument(modes_name, index, argument_name)

Parameters

[in] modes_name <*str*> : The mode(s) parameter name to get argument.
[in] index <*int*> : The array index of modes parameter to indicate a specific mode.
[in] argument_name <*str*> : The name of the argument to get.

Return Value

argument_value <*str*> : The value of the argument to get.

Exception

BarcodeReaderError : If error happens, this function will throw a BarcodeReaderError exception that can report the detailed error message.

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
settings.binarization_modes[0] = EnumBinarizationMode.BM_LOCAL_BLOCK
try:
    reader.update_runtime_settings(settings)
    error = reader.set_mode_argument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1")

    value = reader.get_mode_argument("BinarizationModes", 0, "EnableFillBinaryVacancy")
    print(value)
except BarcodeReaderError as e:
    print(e)

Remarks
Check the available modes and arguments below:

get_runtime_settings

Gets current settings and saves them into a PublicRuntimeSetting object.

BarcodeReader.get_runtime_settings()

Return Value

runtime_settings <*class PublicRuntimeSetting*> : a PublicRuntimeSetting object with the current runtime settings.

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
print(settings.barcode_format_ids)
print(settings.expected_barcodes_count)

update_runtime_settings

Updates runtime settings with a given PublicRuntimeSetting object.

BarcodeReader.update_runtime_settings(settings)

Parameters

[in] settings <*class PublicRuntimeSetting*> : a PublicRuntimeSetting object.

Exception

BarcodeReaderError : If error happens, this function will throw a BarcodeReaderError exception that can report the detailed error message.

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
settings.barcode_format_ids = EnumBarcodeFormat.BF_ONED
settings.expected_barcodes_count = 4
try:
    reader.update_runtime_settings(settings)
    changed_settings = reader.get_runtime_settings()
    print(changed_settings.barcode_format_ids)
    print(changed_settings.expected_barcodes_count)
except BarcodeReaderError as e:
    print(e)

reset_runtime_settings

Resets all parameters to default values.

BarcodeReader.reset_runtime_settings() 

Code Snippet

from dbr import *
reader = BarcodeReader()

settings = reader.get_runtime_settings()
settings.barcode_format_ids = EnumBarcodeFormat.BF_ONED
settings.expected_barcodes_count = 4
try:
    reader.update_runtime_settings(settings)
    changed_settings = reader.get_runtime_settings()
    print(changed_settings.barcode_format_ids)
    print(changed_settings.expected_barcodes_count)

    reader.reset_runtime_settings()
    reset_settings = reader.get_runtime_settings()
    print(reset_settings.barcode_format_ids)
    print(reset_settings.expected_barcodes_count)
except BarcodeReaderError as e:
    print(e)

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 9.0.0
  • 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.6.0
  • Version 7.5.0
Change +
© 2003–2022 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support