phonegap条形码扫描仪不扫描pdf417条形码

时间:2018-04-24 10:19:45

标签: cordova phonegap-plugins barcode-scanner phonegap pdf417

我正在尝试使用此https://github.com/phonegap-build/BarcodeScanner存储库扫描pdf417条形码。我的主要目的是扫描美国驱动程序的许可证并获取它的全部细节,但它总是显示错误的结果和不同的格式UPC_E ,EAN_8即使我扫描pdf417格式条形码。我也添加了格式过滤器,但它不起作用。有人尝试过与此相关的事情吗?

cordova.plugins.barcodeScanner.scan(
      function (result) {
          alert("We got a barcode\n" +
                "Result: " + result.text + "\n" +
                "Format: " + result.format + "\n" +
                "Cancelled: " + result.cancelled);
      }, 
      function (error) {
          alert("Scanning failed: " + error);
      }
   );

1 个答案:

答案 0 :(得分:0)

默认情况下,条形码扫描程序插件不会扫描PDF417,除非您将其添加到插件设置中。

你已经链接到https://github.com/phonegap-build/BarcodeScanner,这是一个不再使用mantained插件的4岁分叉,它缺少完整的文档。在我个人看来,它已经像Windows 98一样过时了。

正如您在较新的 phonegap-plugin-barcodescanner 中看到的那样,如果您想阅读这些代码,则必须将 PDF417 添加到formats列表中

{
    preferFrontCamera : true, // iOS and Android
    showFlipCameraButton : true, // iOS and Android
    showTorchButton : true, // iOS and Android
    torchOn: true, // Android, launch with the torch switched on (if available)
    saveHistory: true, // Android, save scan history (default false)
    prompt : "Place a barcode inside the scan area", // Android
    resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500

    /* Add here PDF_417 to support it */
    formats : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED

    orientation : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device
    disableAnimations : true, // iOS
    disableSuccessBeep: false // iOS and Android
    disableSuccessBeep: false // iOS and Android
}

我强烈建议尽可能只使用官方的,最新的插件,如果某些内容无法按预期运行,请在问题部分报告搬到旧叉子。

Android 6.0改变了权限系统,之前的大多数插件现在已经过时了。

相关问题