我正在尝试在测试项目中使用 zxing.net,这是我的代码:
protected void Button1_Click(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
Bitmap bitmap = new Bitmap(Server.MapPath(Image1.ImageUrl));
BarcodeReader reader = new BarcodeReader
{
AutoRotate = true,
TryInverted = true,
Options = new ZXing.Common.DecodingOptions
{
TryHarder = true,
PossibleFormats = new List<BarcodeFormat>
{
BarcodeFormat.EAN_13
//BarcodeFormat.QR_CODE
}
}
};
Result result = reader.Decode(bitmap);
string decoded = "???";
if (result != null)
{
decoded = result.ToString().Trim();
}
this.TextBox1.Text = decoded;
}
}
这个返回总是空的......为什么?ean.png 如下: ean13 示例
非常感谢你。