BarcodeReaderCLI Output |
Format of output file is defined by the output file name extension.
XML for a file with .xml extension
JSON for a file with .json extension
CSV for a file with .csv extension
BIN for a file with .bin extension
Text for a file with any other extension. The -output-text option mast be set.
If XML, JSON, CSV or Text file already exists, the output action depends on the value of -if-exists option.
overwrite replaces the existing file
append adds
the new data to the existing file.
unique adds
a unique index to the filename preceding the extension, i.e. the modified filename
becomes: basename.NNNN.ext
Where NNNN is a unique file
index.
error generates a runtime error
Multiple output files can be specified, each requiring a
separate -output option value.
Options -fields, -output-text,
-if-exists must be set before the
-output option in order for their value to be
applied to that output file.
Different options can be specified before separate -output
options to create multiple, different outputs from the same session.
Console output is generated if -output=console OR no -output option is set
Console output is send to stdout. All diagnostics, versions and help information are sent to stderr.
Format of console output is defined by the -format option. Default is XML.
If -format=text then the -output-text option must be set
The no -output option is set, the last values of the -format, -fields, and -output-text options are applied to the console output.
Content of XML, JSON, and CSV outputs is defined by the -fields option
CSV Format: Double quotes ("") enclose:
Barcode text values
Filenames containing spaces or commas
Content of Text outputs is defined by -output-text option
Text values are stored as UTF-8 in order to accurately represent
local language text values.
If barcode contains binary data, it's text value is modified
per XML, JSON and CSV format requirements.
If output is appended to an existing file:
XML format: adds <session> node to the root element
JSON format adds object to "sessions":[] array
CSV format: append new rows. The existing header row is not updated.
Text format: append new text
The output file contains a single barcode value as a byte array.
If the image contains multiple barcode defined a unique name to hold output of each barcode.
For example: some-folder/some-prefix.{filename}.p{page}.i{ind}.t{type}.bin
BIN output is not available for console output
A BIN output file can not be appended
Text format output is based on the macro expansion.
By default output is initiated when new barcode is read.
To trigger processing on other events an event identifier
must precede macro reference.
Available event identifiers are:
Event identifier | Event | Macros available for expansion |
[onSesion] | After session started | Environment variables macros |
[onSource] | Source processing is completed |
all of the above + Source macros |
[onFile] | Image file processing is completed |
all of the above + File macros |
[onPage] | Page processing is completed |
all of the above + Page macros |
[onBarcode] | Barcode is read |
all of the above + Barcode macros |
[onDrvLic] | Barcode with driver license data is read |
all of the above + Driver license macros |
Text outside of the macro reference is copied to the output as is.
{text}{nl}Example 2 - Complete text output with events processing:
[onSession]{tab}SESSION: application: {app.filename}{tab} {app.version} {tab} date/time: {start.date} {start.time} [onSource]{tab|#x2}SOURCE: type: {type} path: {path} {tab|#x2} files: {files} bc.count: {bc.count} [onFile]{tab|#x3}FILE path: {path} {tab|#x3} pages: {pages} format: {format} size: {size} bc.count: {bc.count} [onPage]{tab|#x4}PAGE:path: {path} page: {page} {tab|#x4} width: {width} height: {height} bpp: {bpp} hdpi: {hdpi} vdpi: {vdpi} {tab|#x4} compr: {compr} bc.count: {bc.count} [onBarcode]{tab|#x5}BARCODE: type: {type} length: {length} {tab|#x5} rectangle: {rectangle.left}:{rectangle.top}-{rectangle.right}:{rectangle.bottom} {tab|#x5} rotation: {rotation} path: {path} page: {page} {tab|#x5} skew: {skew} mode: {mod} encoding: {encoding} {tab|#x5} text: {text} {tab|#x5} data: {data} [onDrvLic]{tab|#x6} DRIVER LICENSE: {tab|#x6} NAME: {last} {middle} {first} {tab|#x6} DATA: {dob} EYES: {eyes} HAIR: {hair} SEX: {sex} HEIGHT: {height} WEIGHT: {weight} {tab|#x6} ADDRESS: {street} {city} {state} {postal} {tab|#x6} LICENSE: {id} ISSUED: {issued} EXPIRES: {expires}