Macro expansion |
In the most cases macro is reference by its name enclosed in curly
brackets: {macro.name}.
Macro names are case-insensitive.
General macro references format is: {namespace::macro.name?|format}
Sections in italic repaints variable values.
Where:
namespace:: - optional namespace to distinguish macros with the same name defined in multiple categories.
macro.name - required name of a macro
? - optional mark to expand undefined macro to an empty string. Without ? mark undefined macro causes runtime error.
|format - optional macro expansion control. Available options:
#xN - duplicate macro value N times.
#n - expands to macro name.
#v - expands to macro value.
Examples:
{tab|#x3} expands to 3 tab characters
{dob?|#n is #v} expands to a string dob is user_date_of_birth , if current barcode contains driver license data, otherwise it expands to an empty string
{path.temp}{path.sep}MyOutput.xml expands to a MyOutput.xml file path located in a temporary folder, e.g. /tmp/MyOutput.xml
{bc::page} expands to page number in a file, where barcode is located.
Macros can be predefined, specified
The Session macros remain constant in the course of BarcodeReaderCLI session.
The namespace for these macros is prg::.
Name | Value description |
path.tmp | System temporary folder path (without terminating path separator} |
path.sep | Path separator character: \ on Windows, / on Linux |
host | Host computer name |
app.filename | BarcodeReaderCLI file name |
app.version | BarcodeReaderCLI version |
start.date | Session start data. Format: YYYY-MM-DD |
start.time | Session start time. Format: hh:mm:ss |
nl | New line character |
cr | Carriage return character |
eol | Carriage return + New line characters |
tab | Tab character |
bom | UTF-8 byte-order mark (BOM) |
Selected environmental variables are converted to a macro. The namespace for these macros is env::.
The User macros are defined using -d="macro.name=macro.value"
option on a command line or in configuration file. The namespace for
these macros is user::.
Value of user macros referenced in filename options can reference other
user macros (Recursive expansion.)
The Source macros are associated with the currently processed source.
The namespace for these macros is source::.
Name | Value description |
path | Source path specified on a command line |
type | Source type: file, folder, url |
files | Number of files found in source |
bc.count | Total number of found barcodes |
The File macros are associated with the currently processed image
file. The namespace for these macros is file::.
Name | Value description |
path | Image file path |
filename | Filename section of path |
basename | Filename without extension |
ext | Extension portion of filename |
folder | Path to a folder containing image file |
pages | Number of pages in a file |
format | Image file format |
size | Size of image file |
bc.count | Total number of found barcodes |
The Page macros are associated with the currently processed image
page. The namespace for these macros is page::.
Name | Value description |
page | Page number (1-based) |
bpp | Bits-per-pixel |
width | Page width in pixels |
height | Page height in pixels |
hdpi | Horizontal DPI |
vdpi | Vertical DPI |
compr | Page compression |
path | Path to image file containing this page |
bc.count | Total number of found barcodes |
The Barcode macros are associated with the currently processed barcode.
The namespace for these macros is bc::.
Name | Value description |
ind | Barcode index on a page |
text | Barcode text value as UTF-8 string |
data | Barcode value as a byte array, encoded as base-64 string |
length | Barcode value length |
type | Barcode type |
rotation | Barcode rotation |
encoding | Encoding used to convert barcode data to UTF-8 text |
tbr | TBR code used to read this barcode (not present if code was not set) |
path | Image file path |
abspath | Image file absolute path |
page | Page number (1-based) |
mod | Barcode module size in pixels |
skew | Barcode skew |
rectangle.left | Left coordinate of the encompassing rectangle |
rectangle.top | Top coordinate of the encompassing rectangle |
rectangle.right | Right coordinate of the encompassing rectangle |
rectangle.bottom | Bottom coordinate of the encompassing rectangle |
coreners.tl.x | X coordinate of the top left corner |
coreners.tl.y | Y coordinate of the top left corner |
coreners.tr.x | X coordinate of the top right corner |
coreners.tr.y | Y coordinate of the top right corner |
coreners.bl.x | X coordinate of the bottom left corner |
coreners.bl.y | Y coordinate of the bottom left corner |
coreners.br.x | X coordinate of the bottom right corner |
coreners.br.y | Y coordinate of the bottom right corner |
The Driver License macros are associated with the currently processed
barcode, it it contains driver license or ID card data. The namespace
for these macros is dl::.
Name | Value description |
last | Cardholder family name |
first | Cardholder first name |
middle | Cardholder middle name |
dob | Cardholder date of birth |
eyes | Cardholder eyes color |
hair | Cardholder hair color |
sex | Cardholder sex |
height | Cardholder height in ft. and inch |
weight | Cardholder weight in pounds |
street | Cardholder street address |
city | Cardholder city |
state | Cardholder state or province |
postal | Cardholder ZIP or postal code |
id | Card ID number |
issued | Card issue date |
expires | Card expiration date |