【问题标题】:Unable to scan code39 barcodes - xamarin forms无法扫描 code39 条码 - xamarin 表单
【发布时间】:2018-05-30 14:07:38
【问题描述】:

我正在使用 ZXing.Mobile.Forms 来扫描条形码。 我正在尝试扫描 Code39 格式的条形码。 如果条形码的值较少,例如 1231214,14123,那么它会给我一个结果。但它不会扫描值超过 32 位的条形码。 我附上了无法扫描的条形码图像。 barcode image

请帮我解决这个问题。

这是我从示例中得到的代码:

        var scanner = new ZXing.Mobile.MobileBarcodeScanner();
        var option = new ZXing.Mobile.MobileBarcodeScanningOptions { UseCode39ExtendedMode = true, TryHarder = true, PureBarcode = true };
        var result = await scanner.Scan(option);

        if (result != null)
            await Application.Current.MainPage.DisplayAlert("It says..", result.Text, "Cancel");
        await Application.Current.MainPage.Navigation.PopAsync(true);

谢谢, 阿吉特巴布

【问题讨论】:

    标签: xamarin.forms zxing.net


    【解决方案1】:

    我刚刚使用ZXing.Net.Mobile.Forms 版本2.4.1 对iOS 设备进行了快速测试,它与您的图像一起正常工作:1M8GDM9AXKPO42788。所以这不是库问题,而是硬件问题、代码问题或可见性条件。

    这是对我有用的代码:

    async void Handle_Clicked(object sender, System.EventArgs e)
    {
        var scanner = new ZXing.Mobile.MobileBarcodeScanner();
        var result = await scanner.Scan();
    
        if (result != null)
            Console.WriteLine("Scanned Barcode: " + result.Text);
    }
    

    【讨论】:

    • 好的,我明白了,如果我的条形码中有小值,它就可以工作,还尝试扫描我 CPU 中的条形码,不幸的是它没有工作。请检查我现在包含代码的问题。
    • 你的问题太宽泛了。 barcode in my CPU - 那是哪种条形码类型? ZXing支持吗?请注意细节。我用对我有用的代码更新了我的答案。您使用的硬件(手机型号)是什么?难道是相机无法处理非常小的条形码?换个手机试试。能见度条件如何?会不会是天黑了?在这种情况下尝试使用手电筒。
    • 其实我的目的是扫描汽车的VIN。
    • 是的,我用的是小米红米5,可见条件在这里很清楚。不需要手电筒或灯光没有问题。我不确定它是否可以处理小条形码。但我希望它可以处理它扫描的任何大小的条形码。
    猜你喜欢
    • 2013-12-12
    • 2020-12-03
    • 2016-09-16
    • 1970-01-01
    • 2016-10-29
    • 1970-01-01
    • 1970-01-01
    • 2017-09-30
    • 1970-01-01
    相关资源
    最近更新 更多