Configuration Details
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: falseConfiguration Options
| Option | Type | Default | Description |
|---|---|---|---|
debug | boolean | false | Show debug messages in console/terminal |
tofile | boolean | false | Save log output to a file (creates new file per startup) |
filename | string | ./logs/log.txt | Path and filename for log files |
loglevel | number | 5 | Controls which messages are logged (see below) |
sourceinfo | boolean | false | Include 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) withdebug: 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: TEXTConfiguration Options
| Option | Type | Default | Description |
|---|---|---|---|
autocleanparts | boolean | true | Automatically clean raw data by removing/replacing filler characters (<) |
usecorrector | boolean | false | Enable automatic correction of OCR errors in MRZ data |
ignorefillerchecksnonzero | boolean | true | Ignore validation errors when filler positions contain non-zero values |
allowexperimentalparsers | boolean | true | Enable support for experimental document types (vehicle registration, non-standard MRZ) |
addextendedinfo | boolean | true | Include readable field names and parsed/sub-parsed values in output |
addchecksinfo | boolean | true | Add validation information (check digits, expiration, age verification) |
agetop | number | 18 | Upper age limit for age verification checks |
agebottom | number | 16 | Lower age limit for age verification checks |
translateids | boolean | false | Translate field IDs to human-readable names (reserved for future use) |
outputformat | string | TEXT | Default 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<becomesSMITH 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 oldCommon 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: 0sConfiguration Options
| Option | Type | Default | Description |
|---|---|---|---|
preferredportname | string | "" (auto) | Specific serial port to use (e.g., /dev/ttyUSB0 or COM4) |
preferredvidpid | string | "" (auto) | USB Vendor ID and Product ID (e.g., 0403:6001) |
baudrate | number | 115200 | Communication speed: 9600, 19200, 38400, 57600, 115200 |
databits | number | 8 | Data bits per transmission: 7 or 8 |
stopbits | number | 0 | Stop bits: 0 = 1 stop bit, 1 = 1.5 stop bits, 2 = 2 stop bits |
parity | number | 2 | Parity checking: 0 = none, 1 = odd, 2 = even, 3 = mark, 4 = space |
timeout | string | 0s | Read 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-detectSpecifying 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 SerialNote: Most users can leave serial settings at their defaults. Only modify if experiencing connection issues.
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://localhostMain Configuration
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable automatic output of scan results |
outputitems | array | - | 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:
| Placeholder | Description | Example |
|---|---|---|
<time> | Current timestamp | 20231215-143022 |
<doccode> | Document type code | P (passport), ID (ID card) |
<docnum> | Document number | AB1234567 |
<issuer> | Issuing country | USA, NLD, DEU |
<name_first> | First name | JOHN |
<name_last> | Last name | SMITH |
Example file names:
<time>-<doccode>-<issuer>→20231215-143022-P-USA.txt<docnum>-<name_last>→AB1234567-SMITH.jsonscan-<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/scansThe 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.1Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable the built-in web server |
port | number | 8080 | HTTP port (will auto-increment if port is in use) |
rootfolder | string | ./www | Directory containing web interface files |
autoopen | boolean | true | Automatically 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:8080Security 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.100When 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.101NFC Settings
Configures NFC chip reading for electronic documents (e-passports, e-ID cards).
nfc:
enabled: true
dumpraw: false
dumprawfolder: ./rawnfcfiles
readphoto: true
apdulog: false
apdulogfile: ./apdu.log.json
loadspecimencsca: false
reading:
smartagemode: false
images:
convertjp2: true
quality: 75
output:
simpledatalist: true
simpleimagelist: true
fullinfo: false
parsedlist: trueMain Configuration
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable NFC chip reading functionality |
dumpraw | boolean | false | Save raw NFC data files for debugging |
dumprawfolder | string | ./rawnfcfiles | Folder to store raw NFC files |
readphoto | boolean | true | Extract facial photo from chip (DG2 for e-passports, DG6 for e-DL) |
apdulog | boolean | false | Log all APDU commands (slow, debug only) |
apdulogfile | string | ./apdu.log.json | APDU log file location |
loadspecimencsca | boolean | false | Load specimen CSCA certificates (testing only - never use in production) |
Reading Options
reading:
smartagemode: false| Option | Type | Default | Description |
|---|---|---|---|
smartagemode | boolean | false | Stop reading once age information is available (faster for age verification only) |
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
Image Processing
images:
convertjp2: true
quality: 75| Option | Type | Default | Description |
|---|---|---|---|
convertjp2 | boolean | true | Convert JPEG2000 images to JPEG using ImageMagick (must be installed) |
quality | number | 75 | JPEG 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| Option | Type | Default | Description |
|---|---|---|---|
simpledatalist | boolean | true | Include basic pre-selected data fields (name, DOB, document number, etc.) |
simpleimagelist | boolean | true | Include basic images (facial photo, signature) |
fullinfo | boolean | false | Include complete data from all Data Groups (large output, slower processing) |
parsedlist | boolean | true | Include parsed and formatted data items |
Recommended Settings:
Fast, minimal output:
simpledatalist: true
simpleimagelist: false
fullinfo: false
parsedlist: trueComplete verification:
simpledatalist: true
simpleimagelist: true
fullinfo: true
parsedlist: trueAge verification only:
simpledatalist: true
simpleimagelist: false
fullinfo: false
parsedlist: false
reading:
smartagemode: trueCustom Fields
Add custom metadata to scan results for tracking and organization.
customfields:
scannerid: 123456789
location: Harderwijk
country: NLDCustom 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: 2Device 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: falseExample 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-detectWindows 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: falseEnable smart age mode:
nfc:
reading:
smartagemode: trueWeb Interface Not Opening
Check port availability:
server:
port: 8080 # Try 8081, 8082, etc. if 8080 is in useManually open browser:
- Navigate to:
http://localhost:8080
Output Files Not Created
Enable output:
output:
enabled: true # Must be trueCheck file path:
outputitems:
- name: File
config:
file_path: ./scans/ # Make sure folder existsCORS Errors in Browser
Enable CORS for network access:
server:
wscors:
enabled: true
trustedorigins:
- http://your-ip:8080
httpcors:
enabled: true
trustedorigins:
- your-ipBest Practices
Security
Never enable specimen CSCA in production
nfc: loadspecimencsca: false # Always false in production!Limit CORS to specific origins
trustedorigins: - http://192.168.1.50:8080 # Specific IPs onlyUse HTTPS for URL output
- name: URL config: url: https://secure-api.example.com # Use HTTPS
Performance
Disable unused features
- Turn off NFC if only scanning MRZ
- Disable photo reading if not needed
- Use smart age mode for age verification
Optimize logging
system: loglevel: 3 # Warning level for production debug: false tofile: falseAdjust image quality
nfc: images: quality: 75 # Lower for faster processing
Reliability
Enable logging for troubleshooting
system: tofile: true loglevel: 2 # Info levelKeep backups of configuration
- Save your working
config.yml - Document custom settings
- Save your working
Test changes incrementally
- Modify one section at a time
- Verify functionality after each change
Getting Help
If you encounter issues with configuration:
- Check the log files (if
tofile: true) - Enable debug mode (
debug: true,loglevel: 0) - Verify YAML syntax - Indentation matters in YAML files!
- Review examples in this guide
- Contact support with your configuration file and log files
Quick Reference
Common Settings to Change
| What you want to do | Setting to modify |
|---|---|
| Save scans to file | output.enabled: true + configure File output |
| Change web port | server.port: 8080 |
| Enable age verification | mrz.agetop and mrz.agebottom |
| Skip photo reading | nfc.readphoto: false |
| Reduce logging | system.loglevel: 3 or higher |
| Enable network access | Enable CORS in server section |
| Specify serial port | serial.preferredportname: "COM4" |
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)
On This Page
- Overview
- Configuration File Location
- System Settings
- Configuration Options
- Log Levels
- MRZ Settings
- Configuration Options
- Understanding Auto Clean and Corrector
- Age Verification
- Serial Port Settings
- Configuration Options
- Port Auto-Detection
- Specifying a Port
- Using Vendor/Product ID
- Output Settings
- Main Configuration
- Output Item Types
- File Output
- URL Output
- Multiple Output Destinations
- Server Settings
- Configuration Options
- WebSocket CORS Settings
- HTTP CORS Settings
- Example: Multi-Computer Setup
- NFC Settings
- Main Configuration
- Reading Options
- Image Processing
- Output Options
- Custom Fields
- Configuration Examples
- Example 1: Simple Local Setup
- Example 2: Age Verification Kiosk
- Example 3: Border Control / Security
- Example 4: Development and Testing
- Troubleshooting
- Scanner Not Connecting
- Slow NFC Reading
- Web Interface Not Opening
- Output Files Not Created
- CORS Errors in Browser
- Best Practices
- Security
- Performance
- Reliability
- Getting Help
- Quick Reference
- Common Settings to Change
- File Locations