User Documentation

Configuration

The configuration file is a YAML document.

The sample configuration (found in etc/random.yaml) is

input:
  name: data/input.csv
output:
  folder: output/
  file:
    name: output.csv
random:
  size: 128
  codes:
    -
      type: qrcode
      size: 120x120
      errorcorrection: M
      filetype: png
      encoding: hex
      url: https://www.example.org/{code}
  encodings:
    - base58

The configuration file sections are explained next.

Configuration Sections

Input

The input section defines the input data for which random numbers will be generated.

input:
  name: data/input.csv

The path of the input file is relative to the current working directory.

The input file is a simple csv file in which the identifiers are defined. The only column in this file is a list of identifiers.

Example:

A001
A002
B003

This input file defines 3 identifiers.

Important The file may not contain any duplicated identifiers.

Currently the input file may not contain a header.

Output

The output section defines the configuration for the output.

output:
  folder: output/
  file:
    name: output.csv

The first item (folder) defines where all output files will be placed into. This includes the csv output file and all barcodes generated.

The folder is relative to the current working directory.

The output file is a csv file with the first column containing the identifiers from the input file and then the random numbers encoded in the different encodings defined in the Random section.

The generated barcodes will be placed also in the output folder and have the following filename: <barcode type>-<encoding>-<identifier>.<filetype>.

A barcode for an identifier 0001 for a qrcode with random number encoding hex as png-file is named qrcode-hex-0001.png.

Random

Overview

The random section defines the random number generated and how this should be encoded.

random:
  size: 128
  codes:
    -
      type: qrcode
      size: 120x120
      errorcorrection: M
      filetype: png
      encoding: hex
      url: https://www.example.org/{code}
  encodings:
    - base58

The size defines the size is bits of the random number. This must be a multiple of 8.

The subsection codes defines the barcodes to be generated. The subsection encodings defines additional encodings are written into the output file without generating a barcode.

At least one subsection (codes or encodings) with at least one entry must exists.

codes

The codes subsection defines the barcodes that should be created. Each entry has multiple attributes.

The required attributes are type and encoding.

The attribute type defines the type of the barcode to generate. All supported barcodes are listed in Barcodes.

The attribute size defines the size of the barcode. If this attribute is left out then a size of 200x200 is used. To define a square barcode a single figure (e.g. 150) can be used.

The attribute errocorrection depends on the type of the barcode. The possible values and the default value is defined in the list of supported barcodes.

The attribute filetype defines the filetype of the barcode output. The currently supported filetypes are listed in Filetypes.

The attribute encoding defines the encoding of the random number. The currently supported encodings are listed in Encodings.

The attribute url defines a free text which is encoded into the barcode. A typical text is an URL that embeds the generated code. To place the code in the text use the placeholder {code}.

encodings

The encodings subsection defines the additional encodings that should be written into the output file. This can be useful to differentiate between a code in a barcode and a code that is be given to the customer in another way (e.g. in printed form).

The encodings subsection is simply a list of encodings like the encoding in the codes subsection.

Supported Encodings, Barcodes and Filetypes

Encodings

Currently supported encodings:

Barcodes

Currently supported barcodes and possible error corrections (default error correction emphasized):

  • aztec
  • datamatrix (25 to 100)
  • qrcode (L, M, Q, H)

Filetypes

Currently supported filetypes:

  • bmp
  • gif
  • jpeg
  • pcx
  • png
  • pnm
  • tiff