Documentation / Desktop and server
On this page
One DLL with a C API, for desktop apps, kiosks and services. OpenCV, the fallback reader and the C++ runtime are linked in: it needs only Windows' own DLLs.
Needs: Windows 10 or later, x64.
The package
mrzscanner-windows-x86_64-2.5.0.zip, under Downloads in the portal:
bin/mrzscanner.dll |
the library: ship it next to your .exe |
lib/mrzscanner.lib |
import library for Visual Studio (MSVC) |
lib/libmrzscanner.dll.a |
import library for MinGW / clang |
include/mrzscanner.h |
the C API, documented in the header |
tessdata/mrz.traineddata |
the fallback reader's model: pass this folder to mrz_scanner_create |
example/scan.c |
a complete example (PGM / PPM images) |
Use
#include "mrzscanner.h"
mrz_register_license("MRZ2...", "com.example.app", "", 4); /* 4: desktop / server */
mrz_status status;
mrz_scanner *scanner = mrz_scanner_create("C:\\MyApp\\tessdata\\", &status);
mrz_image image = {pixels, width, height, 0, MRZ_PIXEL_BGRA8}; /* or RGB8, BGR8, RGBA8, GRAY8 */
mrz_result *result = NULL;
if (mrz_scan_image(scanner, &image, NULL, &result) == MRZ_OK) {
puts(mrz_result_text(result)); /* the MRZ lines */
puts(mrz_result_json(result)); /* the parsed fields */
}
mrz_result_free(result);
mrz_scanner_destroy(scanner);
Build:
cl app.c /I include lib\mrzscanner.lib # Visual Studio
cc app.c -I include -L lib -lmrzscanner # MinGW / clang
Good to know
- The folder passed to
mrz_scanner_createmust be namedtessdataand end with a separator. - A scanner is used by one thread at a time: create one per thread.
- Define
MRZ_STATIConly when linking a static build of the core, not this DLL. - .NET: in a .NET MAUI app use the
MRZScanner.Mauipackage; plain .NET can call the DLL with P/Invoke. - Python:
pip install mrzscanneris the same library.
Updated Oct 24, 2026 ยท Questions? Ask us