Skip to main content
Version: v8xxx

Scan barcodes

By default, BlinkID runs all four extraction modules.

To use BlinkID as a standalone barcode scanner, disable all the modules except barcodeModule.

When documentCaptureModule is disabled, additional barcode formats that are otherwise unavailable become enabled: UPC-E, UPC-A, Code 128, Code 39, EAN-8, EAN-13, ITF, Data Matrix, and Aztec.

note

pdf417ScanningEnabled and qrScanningEnabled must always be enabled or disabled together.

Use the standalone barcode use case​

note

Added in BlinkID Web v8003.0.0, and in BlinkID Android and iOS v8002.0.0. Earlier v8xxx versions don't have use cases; follow Configure the session instead.

The standalone barcode use case builds session settings for barcode-only scanning in one call. It disables all modules except barcodeModule, enables every supported barcode format, makes barcode presence mandatory, and scans a single side.

import { createBlinkId } from "@microblink/blinkid";

const blinkId = await createBlinkId({
licenseKey: "your-license-key",
presetScanningSettingsBuilder: (presetBuilder) =>
presetBuilder.buildStandaloneBarcodeSettings(),
});
tip

To read only the barcode of a detected document, rather than any barcode in the frame, use the document video use case with the barcode-only scenario.

Configure the session​

note

Applies to versions earlier than BlinkID Web v8003.0.0, and BlinkID Android and iOS v8002.0.0. If you have a newer version, you can also use the standalone barcode use case.

Disable documentCaptureModule, mrzModule, and vizModule by setting each to null (web, Android) or nil (iOS). Leave barcodeModule enabled. On Flutter and React Native, modules you leave out of the scanning settings are disabled, so set only barcodeModule.

import { createBlinkId } from "@microblink/blinkid";

const blinkId = await createBlinkId({
licenseKey: "your-license-key",
scanningSettings: {
documentCaptureModule: null,
mrzModule: null,
vizModule: null,
},
});

Read the result​

The barcode result is available on the per-side sub-result. barcodeData contains the raw bytes and the decoded string. For driver's licenses and other AAMVA-compliant documents, the barcode data is also parsed into structured fields.

blinkId.addOnResultCallback((result) => {
const side = result.subResults[0];

// Raw barcode string
console.log("Barcode string:", side.barcode?.barcodeData.stringData);
console.log("Barcode type:", side.barcode?.barcodeData.barcodeType);
console.log("Parsed:", side.barcode?.parsed);

// Parsed fields (populated for AAMVA-compliant documents)
if (side.barcode?.parsed) {
console.log("First name:", side.barcode.firstName);
console.log("Last name:", side.barcode.lastName);
console.log("Date of birth:", side.barcode.dateOfBirth?.gregorian);
console.log("Document number:", side.barcode.documentNumber);
}

void blinkId.destroy();
});