Barcode Reader CLI

Command line reference

Command line format

BarcodeReaderCLI [options] [sources] [@configuration_file]

Where:

options - options specified in this document. See option rules

sources - files, folders, or URLs identifying input files

configuration-file - zero one or more configurations files

Source

The source parameter specifies the location of image files to read barcodes from. Multiple sources can be specified. Sources can be:

  • Local image file
  • Local folder
  • Web-based image. The source name should start with  http://, htpps://

The rules for source values are:

  • The value of the source should use UTF-8 to represent non-English file names
  • The value containing spaces should be enclosed in double quotes ("")
  • The value containing environmental and user macro references expanded at runtime

Options

Option rules

  • Most options are specified as -name=value, except:
    • Options with a value described as a flag are specified as -name
    • the -d option is specified as -d="macro.name=macro.value"
  • If the value is described as a list, zero or more valid values can be set. Multiple values should be separated by a comma (,). No spaces are allowed in the list.
  • All options (except -type) are optional.
  • A new option value (except -output) replaces the previous value. An empty string value sets the option to its default value.
  • For options specifying file names:  -output and -output-text.
    • If the value contains spaces, it should be enclosed in double quotes ("")
    • Environmental and user macro references are expanded at runtime



The order of the options on the command line and in configuration files is important:

  • Reader options and source options should be specified before the source parameter. Thus different options can be applied to individual sources.
  • Output options that apply to output should be specified before the -output option. Thus, different options can be applied to individual outputs.

Reader options

Reader options configure the barcode reader parameters to be applied to a source.

Name

Value Description

Default

Valid values

-type -t

Required. List of barcode types

code39 code128 ucc128 pdf417 qr datamatrix drvlic

code39 code128 codabar ucc128 code93 upca ean8 upce ean13 i25 datamatrix pdf417 qr drvlic imb bpo aust sing 4state patch

-tbr

List of TBR Codes 

0

Valid TBR codes for a given type are displayed by the TBR Wizard

-dir

List of barcode directions

all

all horz vert

-max-bc -m

A maximum number of barcodes to read on a page. 0 means read all barcodes.

0

0 - 100

-timeout

Barcode reading timeout in seconds. 0 means no timeout.

0

 

-encoding

Encoding to convert barcode data to UTF-8 text. See here

 

 

TBR codes

  • Valid codes for specific barcode types are reported in the TBR Wizard
  • Each TBR code set in -tbr option (if more than one) is applied sequentially to each source page. If the number of barcodes found on a page after applying a TBR code from the list is equal to or more than -max-bc value (if set), the rest of the TBR codes are ignored for this page.

If -tbr option is not set, the default algorithm is used. If TBR codes are changed, to return to the default algorithm to the next source set -tbr=0

Source options - Multi-page file format

This option control processing of multi-page file formats: PDF, TIFF, GIF

Name

Value Description

Default

Valid values

-pages

List of page selectors to limit reading to a set of pages. NMB is an explicit page number (1-based) START is an explicit page number or first STOP is an explicit page number or last CNT is the maximum number of barcodes to detect in a file

all

all even odd first last NMB START-STOP maxbc:CNT

If the page range is maxbc:CNT and the value of CNT > 0, then file processing stops once CNT barcodes are found.

Setting a barcode count limit might increase overall processing time since multi-threading is disabled.

Source options - Web-based images

Images from http://, htpps:// sources are downloaded by the curl command-line application.  

  • Linux version is installed with the BarcodeReaderCLI.
  • Windows version is available here and should be installed in the PATH.

The curl is invoked with the following default curl options: -s -S -D -m -o -L

  • Additional options should be set as needed based on the system requirements.
  • BarcodeReaderCLI reports errors returned from the curl.
  • To resolve any problems invoke curl from the command line to identify required curl options.

Name

Value Description

Default

Valid values

-curl-timeout

Total timeout in seconds to download an image with curl. A value of 0.0 disables the timeout.

15.0

Floating point number

-curl-options

Additional curl options. The list of options should be enclosed in the double quotes (""). Use an escape character before any double quotes in the list.

 

-curl-no-redirect

Disable request redirect

 

 

Source options - Folder processing

These options control the selection of image files when the source is a folder.

Name

Value Description

Default

Valid values

-sub

-subfolders

Include subfolders of the source folder in the processing

true

true false

-incl

List of file name masks to be included in the processing

*.tif,*.tiff,*.jpg,*.jpeg,*.pdf,*.bmp,*.png

 

-excl

List of file name masks to be excluded from processing

 

 

Output options

These options control the output generated by BarcodeReaderCLI.

Name

Value Description

Default

Valid values

-output -o

File path - output is sent to the specified file. Zero or more output files can be specified, each requires a separate -output option entry console - output is sent to stdout using -format option.

 

File path

console

-format

Console output format, text value requires --output-text option to be specified.

json

json csv text bin

-output-text

String with macro reference. To define text output in a file, the string should be file://text-file-path, where text-file-path is a template file path.

 

 

-if-exists

Action to take if the output file already exists: overwrite replaces the existing file append adds new data to an existing file (not allowed for bin output) unique adds a unique file index to the filename before the extension error generates a runtime error

overwrite

overwrite append unique error

-fields

For barcodes

Fields to output in json and csv output. Fields values are obtained through macro expansion except: barcode outputs all default fields

text,data, length,type

barcode

-fields

For Driver License Barcodes: Fields to output in json and csv output. Fields values are obtained through macro expansion except: drvlic outputs all default fields.

last,first,middle,dob,eyes,hair, sex,height,weight, street,city,state,postal,id,issued, expires

drvlic











Miscellaneous options

Name

Value Description

-help -h

Flag to output command-line help to console. No processing is done.

-silent -s

Silent mode flag. Do not output the BarcodeReaderCLI version and information

-timeout

Execution timeout in seconds. The default value of 0.0 disables the timeout. Error is returned if total execution time exceeds timeout.

-d

Command line use macros. The format is -d="macro.name=macro.value"

Configuration file

A configuration file is a convenient way to define a set of options and/or sources shared by multiple systems or sessions. For example, they can be used to:

  • Define macros specific to a system, such as the location of source or output files.
  • Define reader options applied to sources specified on a command line.

Zero or more configuration files can be set on the command line. Multiple files are processed in the order of appearance. The format rules for configuration files are:

  • -name sets command line flags
  • -name=value sets command line options with values
  • -d="macro.name=macro.value" specifies a command line use macros.
  • source specifies the location of image files to read barcodes from. It can be an image file, a folder containing image files, or a URL. Values with spaces should be enclosed in double quotes ("some text")
  • # starts the comment portion of a line. If # is the first character, the whole line is treated as a comment.
  • exit ends the processing of a configuration file. The rest of the file is ignored.
  • The configuration file should be in UTF-8 to include non-English file names.