Search docs/

BlinkId

Microblink SDK wrapper for barcode and document scanning. See the blinkid-phonegap repository for available recognizers and other settings

https://github.com/BlinkID/blinkid-phonegap

Cordovaの問題で困っていますか?

本格的なプロジェクトを構築している場合、トラブルシューティングに時間を費やす余裕はありません。Ionicのエキスパートが、保守、サポート、統合に関する公式サポートを提供しています。

今日連絡ください!

インストール

ionic cordova plugin add blinkid-cordovanpm install @ionic-native/blinkid
Ionic EEでは、Ionic Teamが完全にサポートしメンテナンスしているプラグインを利用できます。 詳しくみる連絡ください。
ionic enterprise register --key=YOURPRODUCTKEYnpm install @ionic-enterprise/blinkid

サポートしているプラットフォーム

  • iOS
  • Android

利用方法

import { BlinkId, RecognizerResultState } from '@ionic-native/blinkid/ngx';

constructor(private blinkId: BlinkId) { }

...

const overlaySettings = new this.blinkId.DocumentOverlaySettings();

const usdlRecognizer = new this.blinkId.UsdlRecognizer();
const usdlSuccessFrameGrabber = new this.blinkId.SuccessFrameGrabberRecognizer(usdlRecognizer);

const barcodeRecognizer = new this.blinkId.BarcodeRecognizer();
barcodeRecognizer.scanPdf417 = true;

const recognizerCollection = new this.blinkId.RecognizerCollection([
  usdlSuccessFrameGrabber,
  barcodeRecognizer,
]);

const canceled = await this.blinkId.scanWithCamera(
  overlaySettings,
  recognizerCollection,
  { ios: IOS_LICENSE_KEY, android: ANDROID_LICENSE_KEY },
);

if (!canceled) {
  if (usdlRecognizer.result.resultState === RecognizerResultState.valid) {
    const successFrame = usdlSuccessFrameGrabber.result.successFrame;
    if (successFrame) {
      this.base64Img = `data:image/jpg;base64, ${successFrame}`;
      this.fields = usdlRecognizer.result.fields;
    }
  } else {
    this.barcodeStringData = barcodeRecognizer.result.stringData;
  }
}

...

const overlaySettings = new this.blinkId.BlinkCardOverlaySettings();
const recognizer = new this.blinkId.BlinkCardRecognizer();
recognizer.returnFullDocumentImage = false;
recognizer.detectGlare = true;
recognizer.extractCvv = true;
recognizer.extractValidThru = true;
recognizer.extractOwner = true;

const recognizerCollection = new this.blinkId.RecognizerCollection([recognizer]);
const canceled = await this.blinkId.scanWithCamera(
  overlaySettings,
  recognizerCollection,
  {
    ios: '', //iOS License Key
    android: '' //Android License Key
  },
);

if (!canceled) {
  if (recognizer.result.resultState === RecognizerResultState.valid) {
    const results = recognizer.result;

    if (results.resultState === RecognizerResultState.valid) {
      const ccInfo = {
        cardNumber: Number(results.cardNumber),
        expirationMonth: Number(results.validThru.month),
        expirationYear: Number(results.validThru.year),
        cvv: Number(results.cvv)
      };
    }
  }