问题描述
我正在尝试使用 ZXing 库读取 jpg 图像中的多个条形码。但它只返回一个条形码。我没有得到关于如何修改我的代码以读取多个条形码的任何来源。我的代码是:
private string readPDFBarcode(String fname) {
IBarcodeReader reader = new BarcodeReader()
{
AutoRotate = true,TryInverted = true,Options = new DecodingOptions
{
TryHarder = true,PureBarcode = false,ReturnCodabarStartEnd = true,PossibleFormats = new List<BarcodeFormat> { BarcodeFormat.CODE_128,BarcodeFormat.CODE_39,BarcodeFormat.UPC_E }
}
};
Bitmap oBitmap = new Bitmap(fname);
var result = reader.Decode(oBitmap);
if (result != null)
{
return result.ToString();
}
else {
return "";
}
}
任何建议都会有很大帮助。谢谢!
解决方法
试试这个:
var results = reader.DecodeMultiple(oBitmap);
如果它在您的环境中不可用,请提供有关目标 .net 框架(经典或核心)的一些信息。