Documentation / Cross-platform apps
Package: @mrzscanner/nativescript, for NativeScript 8 and later.
Needs: NativeScript 8 or later (@nativescript/core 8+), Android 7.0 (API 24) or later, iOS 15 or later.
Install
npm install @mrzscanner/nativescript
The plugin sets the iOS deployment target (15.0) and a camera usage text. Your app's App_Resources/iOS/Info.plist can give its own NSCameraUsageDescription.
Use
import { MRZScanner } from '@mrzscanner/nativescript';
await MRZScanner.registerLicense('MRZ2...'); // once; without it some fields are masked
const result = await MRZScanner.scan({ documentTypes: ['passport', 'id'] });
if (result.status === 'read') {
const read = result.reads[0];
console.log(read.text, read.fields.document_number, read.checkDigitsValid);
}
const fromPhoto = await MRZScanner.scanImage({ path: photoPath }); // or { base64 }
scan(settings) opens the camera (asking for the permission), and closes after the first read, or with continuous: true collects each new document until Stop. It resolves with { status, reads, elapsedMs }; status is read, stopped, timeout, permissionDenied, licenseInactive or error. See Scan settings and Scan results.
scanImage(image, options): image is { path } (a file path or URI) or { base64 } (JPEG or PNG); options are { documentTypes, isolatedHeight }. It resolves with the read or null, and runs on the calling thread (about 30-100 ms for a photo).
The types ship with the package.
Updated Oct 31, 2026 ยท Questions? Ask us