【问题标题】:phonegap barcode scanner not scanning pdf417 bar codephonegap 条码扫描仪不扫描 pdf417 条码
【发布时间】:2018-04-24 10:19:44
【问题描述】:

我正在尝试使用此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);
      }
   );

【问题讨论】:

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


    【解决方案1】:

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

    您已链接到 https://github.com/phonegap-build/BarcodeScanner,这是一个 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 改变了权限系统,之前的大部分插件都已经过时了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-13
      • 2013-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多