【发布时间】:2017-03-09 01:38:22
【问题描述】:
我正在使用 Xamarin 表单编写 iOS 应用程序并使用 ZXing 库来扫描条形码。我正在尝试读取驾驶执照 (PDF417) 条形码,但图书馆无法识别该条形码。
如果我在PossibleFormats 中包含UPC 或其他条形码,它们会被正确扫描。
我还确定我要读取的条形码是 PDF417 条形码,因为 Scandit 能够在仅使用 PDF417 条形码时正确识别它。
这是我正在使用的代码。 我需要进行哪些更改才能正确识别 PDF417 条码?
async void Handle_Clicked (object sender, System.EventArgs e)
{
MobileBarcodeScanningOptions options = new MobileBarcodeScanningOptions ();
options.PossibleFormats = new List<ZXing.BarcodeFormat> () {
ZXing.BarcodeFormat.PDF_417
};
options.TryHarder = true;
var scanPage = new ZXingScannerPage (options);
scanPage.OnScanResult += (result) => {
// Stop scanning
scanPage.IsScanning = false;
// Pop the page and show the result
Device.BeginInvokeOnMainThread (async () => {
await Navigation.PopAsync ();
await DisplayAlert ("Scanned Barcode", result.Text, "OK");
});
};
// Navigate to our scanner page
await Navigation.PushAsync (scanPage);
}
【问题讨论】:
-
你使用的ZXing版本支持PDF417吗?
-
另外,您是否通过任何其他扫描仪扫描条形码并获得结果?一些条形码可能很讨厌,例如最后包含垃圾行。值得注意的是,ZXing 对 PDF 417 的支持仍处于测试阶段,因此如果图像不够好,它甚至可能无法识别有效代码。
-
条形码非常清晰,正如我之前所说,Scandit 可以正确识别。
标签: c# xamarin xamarin.ios barcode zxing