Configuration Details

This page is currently only available in English

Overview

This guide explains how to configure your document scanner using the config.yml file. The configuration file uses YAML format and controls all aspects of the scanner’s behavior, from logging to MRZ parsing, NFC reading, and output formatting.

Configuration File Location

The configuration file should be named config.yml and placed in the same directory as the scanner application. A template file (config.template.yml) is provided as a starting point.

System Settings

Controls logging and debug output for troubleshooting.

system:
  debug: false
  tofile: false
  filename: ./logs/log.txt
  loglevel: 5
  sourceinfo: false

Configuration Options

OptionTypeDefaultDescription
debugbooleanfalseShow debug messages in console/terminal
tofilebooleanfalseSave log output to a file (creates new file per startup)
filenamestring./logs/log.txtPath and filename for log files
loglevelnumber5Controls which messages are logged (see below)
sourceinfobooleanfalseInclude source code information in log messages

Log Levels

Choose the appropriate log level based on your needs:

  • 0 - Verbose: Everything including detailed trace information
  • 1 - Debug: Debug messages and above
  • 2 - Info: Informational messages and above
  • 3 - Warning: Warnings and errors only
  • 4 - Error: Errors only
  • 5 - Off: No logging

Recommended Settings:

  • Production: loglevel: 3 (Warning)
  • Development: loglevel: 1 (Debug)
  • Troubleshooting: loglevel: 0 (Verbose) with debug: true

MRZ Settings

Configures Machine Readable Zone parsing behavior.

mrz:
  autocleanparts: true
  usecorrector: false
  ignorefillerchecksnonzero: true
  allowexperimentalparsers: true
  addextendedinfo: true
  addchecksinfo: true
  agetop: 18
  agebottom: 16
  translateids: false
  outputformat: TEXT

Configuration Options

OptionTypeDefaultDescription
autocleanpartsbooleantrueAutomatically clean raw data by removing/replacing filler characters (<)
usecorrectorbooleanfalseEnable automatic correction of OCR errors in MRZ data
ignorefillerchecksnonzerobooleantrueIgnore validation errors when filler positions contain non-zero values
allowexperimentalparsersbooleantrueEnable support for experimental document types (vehicle registration, non-standard MRZ)
addextendedinfobooleantrueInclude readable field names and parsed/sub-parsed values in output
addchecksinfobooleantrueAdd validation information (check digits, expiration, age verification)
agetopnumber18Upper age limit for age verification checks
agebottomnumber16Lower age limit for age verification checks
translateidsbooleanfalseTranslate field IDs to human-readable names (reserved for future use)
outputformatstringTEXTDefault output format: TEXT, JSON, or XML (can be overridden per output item)

Understanding Auto Clean and Corrector

Auto Clean Parts (autocleanparts: true)

  • Removes filler characters (<) from parsed values
  • Example: SMITH<<JOHN< becomes SMITH JOHN
  • Recommended: Keep enabled for cleaner output

Use Corrector (usecorrector: false)

  • Attempts to fix common OCR errors (0→O, 1→I, etc.)
  • May introduce false corrections in some cases
  • Recommended: Start with disabled, enable if experiencing consistent OCR issues

Age Verification

The agetop and agebottom settings define age ranges for validation:

agetop: 18 # Must be under 18 years old
agebottom: 16 # Must be over 16 years old

Common use cases:

  • Alcohol sales: agetop: 999, agebottom: 21
  • Minor verification: agetop: 18, agebottom: 0
  • Senior discount: agetop: 999, agebottom: 65

Serial Port Settings

Configures communication with the scanner hardware via serial connection.

serial:
  preferredportname: ""
  preferredvidpid: ""
  properties:
    baudrate: 115200
    databits: 8
    stopbits: 0
    parity: 2
    timeout: 0s

Configuration Options

OptionTypeDefaultDescription
preferredportnamestring"" (auto)Specific serial port to use (e.g., /dev/ttyUSB0 or COM4)
preferredvidpidstring"" (auto)USB Vendor ID and Product ID (e.g., 0403:6001)
baudratenumber115200Communication speed: 9600, 19200, 38400, 57600, 115200
databitsnumber8Data bits per transmission: 7 or 8
stopbitsnumber0Stop bits: 0 = 1 stop bit, 1 = 1.5 stop bits, 2 = 2 stop bits
paritynumber2Parity checking: 0 = none, 1 = odd, 2 = even, 3 = mark, 4 = space
timeoutstring0sRead timeout (0s = no timeout, or specify like 5s for 5 seconds)

Port Auto-Detection

Leave preferredportname and preferredvidpid empty for automatic detection:

preferredportname: "" # Auto-detect
preferredvidpid: "" # Auto-detect

Specifying a Port

Windows:

preferredportname: "COM4"

Linux/Mac:

preferredportname: "/dev/ttyUSB0"

Using Vendor/Product ID

If multiple serial devices are connected, specify the exact device:

preferredvidpid: "0403:6001" # FTDI USB Serial

Note: Most users can leave serial settings at their defaults. Only modify if experiencing connection issues.

IO Modules

Configures external input/output relay modules — for example to switch lights, gates, or buzzers based on the outcome of a scan, such as turning on a green light when an age check passes and a red light when it fails.

iomodules:
  enabled: false
  baseactions:
    - id: ageok
      title: Age OK
      description: Indicates that the age is above the specified threshold
    - id: agebetween
      title: Age Between
      description: Indicates that the age is between the specified thresholds
    - id: agefail
      title: Age Fail
      description: Indicates that the age is below the specified threshold
    - id: overallok
      title: Overall OK
      description: Indicates that all checks have passed successfully
    - id: overallfail
      title: Overall Fail
      description: Indicates that one or more checks have failed
  actions:
    - baseactionid: ageok
      channel: 1
      enabled: true
      switchtype: 2
      pulseduration: 1000

Main Configuration

OptionTypeDefaultDescription
enabledbooleanfalseEnable IO module support
baseactionsarray-Templates that describe the available trigger conditions
actionsarray-Wires a trigger condition to a physical channel and switch behavior

Base Actions

baseactions describe the conditions that can trigger a switch — they are templates, not switched directly. Each one has an id that you reference from actions.

OptionTypeDescription
idstringUnique identifier referenced by actions[].baseactionid
titlestringHuman-readable name for the condition
descriptionstringExplanation of when this condition is triggered

The built-in condition ids are:

IdTriggered when…
ageokthe age is above the configured threshold (mrz.agetop/mrz.agebottom)
agebetweenthe age is between the configured thresholds
agefailthe age is below the configured threshold
overallokall checks on the document passed
overallfailone or more checks on the document failed

You generally don’t need to modify baseactions — just reference the built-in ids from your actions.

Actions

actions connect a base action (a condition) to a physical output channel and define how that channel should switch when the condition occurs.

OptionTypeDefaultDescription
baseactionidstring-Id of the base action that triggers this action
channelnumber-Output channel to switch (1-4)
enabledbooleantrueEnable or disable this specific action
switchtypenumber2How to switch the channel: 0 = off, 1 = on, 2 = pulse
pulsedurationnumber1000Pulse duration in milliseconds (only used when switchtype is 2)

Example: Age Verification Gate with Indicator Lights

iomodules:
  enabled: true
  actions:
    - baseactionid: ageok
      channel: 1 # green light
      enabled: true
      switchtype: 2
      pulseduration: 2000
    - baseactionid: agefail
      channel: 2 # red light
      enabled: true
      switchtype: 2
      pulseduration: 2000

Output Settings

Configures how and where scan results are saved or sent.

output:
  enabled: false
  outputitems:
    - name: File
      format: TEXT
      config:
        file_name: <time>-<doccode>-<issuer>
        file_path: ./
    - name: URL
      format: JSON
      config:
        url: https://localhost

Main Configuration

OptionTypeDefaultDescription
enabledbooleanfalseEnable automatic output of scan results
outputitemsarray-List of output destinations (can have multiple)

Output Item Types

File Output

Save scan results to local files.

- name: File
  format: TEXT # TEXT, JSON, or XML
  config:
    file_name: <time>-<doccode>-<issuer>
    file_path: ./scans/

File Name Templates:

Use placeholders to create dynamic file names:

PlaceholderDescriptionExample
<time>Current timestamp20231215-143022
<doccode>Document type codeP (passport), ID (ID card)
<docnum>Document numberAB1234567
<issuer>Issuing countryUSA, NLD, DEU
<name_first>First nameJOHN
<name_last>Last nameSMITH

Example file names:

  • <time>-<doccode>-<issuer> → 20231215-143022-P-USA.txt
  • <docnum>-<name_last> → AB1234567-SMITH.json
  • scan-<time> → scan-20231215-143022.xml

URL Output

Send scan results to a web service via HTTP POST.

- name: URL
  format: JSON # TEXT, JSON, or XML
  config:
    url: https://api.example.com/scans

The scanner will POST the scan results to the specified URL in the chosen format.

Multiple Output Destinations

You can configure multiple outputs simultaneously:

output:
  enabled: true
  outputitems:
    - name: File
      format: JSON
      config:
        file_name: <time>-scan
        file_path: ./backup/
    - name: URL
      format: JSON
      config:
        url: https://api.example.com/scans
    - name: File
      format: TEXT
      config:
        file_name: <docnum>-readable
        file_path: ./reports/

Server Settings

Configures the built-in web server for live monitoring and control.

server:
  enabled: true
  port: 8080
  rootfolder: ./www
  autoopen: true
  wscors:
    enabled: false
    trustedorigins:
      - http://localhost:8080
  httpcors:
    enabled: false
    trustedorigins:
      - localhost
      - 127.0.0.1

Configuration Options

OptionTypeDefaultDescription
enabledbooleantrueEnable the built-in web server
portnumber8080HTTP port (will auto-increment if port is in use)
rootfolderstring./wwwDirectory containing web interface files
autoopenbooleantrueAutomatically open browser on startup

WebSocket CORS Settings

Controls WebSocket cross-origin access for real-time updates.

wscors:
  enabled: false # Enable WebSocket CORS
  trustedorigins: # List of allowed origins
    - http://localhost:8080
    - http://192.168.1.100:8080

Security Note: WebSocket CORS can be disabled in trusted local networks. Enable it when:

  • Accessing the scanner from different computers
  • Using custom web interfaces
  • Exposing the scanner to external networks

HTTP CORS Settings

Controls HTTP API cross-origin access.

httpcors:
  enabled: false # Enable HTTP CORS
  trustedorigins: # List of allowed origins
    - localhost
    - 127.0.0.1
    - 192.168.1.100

When to Enable CORS:

  • Local network only, same computer: Keep disabled (default)
  • Local network, multiple computers: Enable and add all computer IPs to trustedorigins
  • External access: Enable with specific domains only

Example: Multi-Computer Setup

server:
  enabled: true
  port: 8080
  autoopen: false # Don't auto-open on server
  wscors:
    enabled: true
    trustedorigins:
      - http://192.168.1.50:8080 # Scanner computer
      - http://192.168.1.100:8080 # Client computer 1
      - http://192.168.1.101:8080 # Client computer 2
  httpcors:
    enabled: true
    trustedorigins:
      - 192.168.1.50
      - 192.168.1.100
      - 192.168.1.101

NFC Settings

Configures NFC chip reading for electronic documents (e-passports, e-ID cards).

nfc:
  enabled: true
  inittimeout: 500
  dumpraw: false
  dumprawfolder: ./rawnfcfiles
  readphoto: true
  apdulog: false
  apdulogfile: ./apdu.log.json
  loadspecimencsca: false
  reading:
    smartagemode: false
    accessmode: secure
  images:
    convertjp2: true
    quality: 75
  output:
    simpledatalist: true
    simpleimagelist: true
    fullinfo: false
    parsedlist: true
  skipparts:
    skippa: false
    skipaa: false
    skipca: false
    skippace: false

Main Configuration

OptionTypeDefaultDescription
enabledbooleantrueEnable NFC chip reading functionality
inittimeoutnumber500Initialization timeout in ms between the context, open and contact steps when connecting to the chip
dumprawbooleanfalseSave raw NFC data files for debugging
dumprawfolderstring./rawnfcfilesFolder to store raw NFC files
readphotobooleantrueExtract facial photo from chip (DG2 for e-passports, DG6 for e-DL)
apdulogbooleanfalseLog all APDU commands (slow, debug only)
apdulogfilestring./apdu.log.jsonAPDU log file location
loadspecimencscabooleanfalseLoad specimen CSCA certificates (testing only - never use in production)

Reading Options

reading:
  smartagemode: false
  accessmode: secure
OptionTypeDefaultDescription
smartagemodebooleanfalseStop reading once age information is available (faster for age verification only)
accessmodestringsecureChip access mode: secure = Most Secure Reading mode, fast = Fastest Reading mode

Smart Age Mode:

  • Useful for age-restricted scenarios (alcohol sales, age gates)
  • Reads minimal data needed to verify age
  • Significantly faster than full chip reading
  • Does not read photos or other biometric data

When to use:

  • Age verification is the only requirement
  • Speed is critical
  • Don’t need full document verification

Access Mode:

  • secure — runs the full set of security checks for the most reliable, tamper-resistant read (recommended for verification scenarios)
  • fast — skips some of the slower security steps to read the chip more quickly, at the cost of some assurance

Image Processing

images:
  convertjp2: true
  quality: 75
OptionTypeDefaultDescription
convertjp2booleantrueConvert JPEG2000 images to JPEG using ImageMagick (must be installed)
qualitynumber75JPEG output quality (1-100, higher = better quality/larger file)

Image Quality Guidelines:

  • 50-60: Low quality, small files (suitable for thumbnails)
  • 75: Good balance of quality and size (recommended)
  • 85-95: High quality, larger files (archival purposes)
  • 100: Maximum quality, very large files

Note: JPEG2000 conversion requires ImageMagick to be installed on your system. Download from: https://imagemagick.org/script/download.php

Output Options

Controls what data is included in NFC scan results.

output:
  simpledatalist: true
  simpleimagelist: true
  fullinfo: false
  parsedlist: true
OptionTypeDefaultDescription
simpledatalistbooleantrueInclude basic pre-selected data fields (name, DOB, document number, etc.)
simpleimagelistbooleantrueInclude basic images (facial photo, signature)
fullinfobooleanfalseInclude complete data from all Data Groups (large output, slower processing)
parsedlistbooleantrueInclude parsed and formatted data items

Recommended Settings:

Fast, minimal output:

simpledatalist: true
simpleimagelist: false
fullinfo: false
parsedlist: true

Complete verification:

simpledatalist: true
simpleimagelist: true
fullinfo: true
parsedlist: true

Age verification only:

simpledatalist: true
simpleimagelist: false
fullinfo: false
parsedlist: false
reading:
  smartagemode: true

Skip Parts

Allows skipping specific authentication steps during NFC reading. Skipping steps can speed up reading, but at the cost of the security guarantees that step provides.

skipparts:
  skippa: false
  skipaa: false
  skipca: false
  skippace: false
OptionTypeDefaultDescription
skippabooleanfalseSkip Passive Authentication (verifies the chip data hasn’t been tampered with, using the document’s certificates)
skipaabooleanfalseSkip Active Authentication (verifies the chip itself is genuine and not cloned)
skipcabooleanfalseSkip Chip Authentication (newer replacement for Active Authentication that also sets up secure messaging)
skippacebooleanfalseSkip the PACE protocol (establishes the secure channel used before reading the chip)

When to skip parts:

  • Only skip a part if you understand what it verifies and your use case doesn’t depend on that guarantee (e.g. quick informational reads where document authenticity isn’t critical)
  • Recommended: leave all parts enabled (false) for verification and border-control scenarios

Custom Fields

Add custom metadata to scan results for tracking and organization.

customfields:
  scannerid: 123456789
  location: Harderwijk
  country: NLD

Custom fields are included in all scan outputs and can contain any information you need. Common uses:

Location Tracking:

customfields:
  location: "Reception Desk"
  building: "Building A"
  floor: 2

Device Management:

customfields:
  scannerid: "SCAN-001"
  department: "Security"
  operator: "John Smith"

Business Logic:

customfields:
  purpose: "Age Verification"
  service_type: "Alcohol Sales"
  pos_id: "REGISTER-5"

You can add as many custom fields as needed. All values must be strings, numbers, or booleans.

Configuration Examples

Example 1: Simple Local Setup

Basic configuration for local use with minimal logging:

system:
  debug: false
  loglevel: 3

mrz:
  autocleanparts: true
  usecorrector: false
  addextendedinfo: true
  addchecksinfo: true

server:
  enabled: true
  port: 8080
  autoopen: true
  wscors:
    enabled: false
  httpcors:
    enabled: false

nfc:
  enabled: true
  readphoto: true
  images:
    quality: 75
  output:
    simpledatalist: true
    simpleimagelist: true
    fullinfo: false
    parsedlist: true

output:
  enabled: false

Example 2: Age Verification Kiosk

Optimized for fast age verification:

system:
  loglevel: 3

mrz:
  autocleanparts: true
  agetop: 999
  agebottom: 21
  addchecksinfo: true

nfc:
  enabled: true
  readphoto: false
  reading:
    smartagemode: true
  output:
    simpledatalist: true
    simpleimagelist: false
    fullinfo: false
    parsedlist: false

server:
  enabled: true
  autoopen: true

customfields:
  location: "Store #1234"
  purpose: "Alcohol Sales"

Example 3: Border Control / Security

Full verification with archival:

system:
  debug: false
  tofile: true
  filename: ./logs/border-log.txt
  loglevel: 2

mrz:
  autocleanparts: true
  usecorrector: true
  allowexperimentalparsers: true
  addextendedinfo: true
  addchecksinfo: true

nfc:
  enabled: true
  dumpraw: true
  dumprawfolder: ./archive/nfc-raw
  readphoto: true
  images:
    quality: 95
  output:
    simpledatalist: true
    simpleimagelist: true
    fullinfo: true
    parsedlist: true

output:
  enabled: true
  outputitems:
    - name: File
      format: JSON
      config:
        file_name: <time>-<doccode>-<docnum>
        file_path: ./archive/scans/
    - name: URL
      format: JSON
      config:
        url: https://border-control-api.gov/scans

customfields:
  checkpoint: "Border Crossing A"
  officer_id: "BC-12345"
  country: "NLD"

Example 4: Development and Testing

Maximum logging and debugging:

system:
  debug: true
  tofile: true
  filename: ./logs/debug-<time>.txt
  loglevel: 0
  sourceinfo: true

mrz:
  autocleanparts: true
  usecorrector: true
  allowexperimentalparsers: true
  addextendedinfo: true
  addchecksinfo: true

serial:
  preferredportname: "COM4"

nfc:
  enabled: true
  dumpraw: true
  apdulog: true
  loadspecimencsca: true
  output:
    fullinfo: true

server:
  enabled: true
  autoopen: true

output:
  enabled: true
  outputitems:
    - name: File
      format: JSON
      config:
        file_name: test-<time>
        file_path: ./test-output/

Troubleshooting

Scanner Not Connecting

Check serial port settings:

serial:
  preferredportname: "" # Try leaving empty for auto-detect

Windows users: Check Device Manager for the correct COM port
Linux users: Check /dev/ for ttyUSB* or ttyACM* devices

Slow NFC Reading

Disable features you don’t need:

nfc:
  readphoto: false # Skip photo if not needed
  output:
    fullinfo: false # Don't read all Data Groups
    simpleimagelist: false

Enable smart age mode:

nfc:
  reading:
    smartagemode: true

Web Interface Not Opening

Check port availability:

server:
  port: 8080 # Try 8081, 8082, etc. if 8080 is in use

Manually open browser:

  • Navigate to: http://localhost:8080

Output Files Not Created

Enable output:

output:
  enabled: true # Must be true

Check file path:

outputitems:
  - name: File
    config:
      file_path: ./scans/ # Make sure folder exists

CORS Errors in Browser

Enable CORS for network access:

server:
  wscors:
    enabled: true
    trustedorigins:
      - http://your-ip:8080
  httpcors:
    enabled: true
    trustedorigins:
      - your-ip

Best Practices

Security

  1. Never enable specimen CSCA in production

    nfc:
      loadspecimencsca: false # Always false in production!
  2. Keep NFC authentication parts enabled

    nfc:
      reading:
        accessmode: secure # Don't use 'fast' unless you understand the trade-off
      skipparts:
        skippa: false
        skipaa: false
        skipca: false
        skippace: false
  3. Limit CORS to specific origins

    trustedorigins:
      - http://192.168.1.50:8080 # Specific IPs only
  4. Use HTTPS for URL output

    - name: URL
      config:
        url: https://secure-api.example.com # Use HTTPS

Performance

  1. Disable unused features

    • Turn off NFC if only scanning MRZ
    • Disable photo reading if not needed
    • Use smart age mode for age verification
  2. Optimize logging

    system:
      loglevel: 3 # Warning level for production
      debug: false
      tofile: false
  3. Adjust image quality

    nfc:
      images:
        quality: 75 # Lower for faster processing

Reliability

  1. Enable logging for troubleshooting

    system:
      tofile: true
      loglevel: 2 # Info level
  2. Keep backups of configuration

    • Save your working config.yml
    • Document custom settings
  3. Test changes incrementally

    • Modify one section at a time
    • Verify functionality after each change

Getting Help

If you encounter issues with configuration:

  1. Check the log files (if tofile: true)
  2. Enable debug mode (debug: true, loglevel: 0)
  3. Verify YAML syntax - Indentation matters in YAML files!
  4. Review examples in this guide
  5. Contact support with your configuration file and log files

Quick Reference

Common Settings to Change

What you want to doSetting to modify
Save scans to fileoutput.enabled: true + configure File output
Change web portserver.port: 8080
Enable age verificationmrz.agetop and mrz.agebottom
Skip photo readingnfc.readphoto: false
Reduce loggingsystem.loglevel: 3 or higher
Enable network accessEnable CORS in server section
Specify serial portserial.preferredportname: "COM4"
Switch lights/relays based on scan resultsiomodules.enabled: true + configure actions
Speed up NFC reading (less secure)nfc.reading.accessmode: fast and/or nfc.skipparts.*

File Locations

  • Configuration file: config.yml (same folder as application)
  • Web interface: ./www/ folder
  • Log files: ./logs/ folder (if enabled)
  • Output files: Configured in output.outputitems[].config.file_path
  • NFC raw files: ./rawnfcfiles/ (if enabled)