[我以为我很愚蠢,只写一些带有条形码字体的文本会使扫描仪读取它。似乎我错了。
因此,在阅读了有关code128条形码的一些文档之后,我了解到:
我的代码是:
public string Str = "MADS";
public string Barcode = null;
public void OnGet()
{
int start = 104;
int end = 106;
int calc = start;
Barcode = start.ToString();
for (var i = 0; i < Str.Length; i++)
{
calc += (Convert.ToChar(Str[i]) - 32) * (i + 1);
Barcode += Str[i];
}
double rem = calc % 103;
Barcode += Convert.ToChar((int)rem + 32).ToString() + end;
Console.WriteLine(Barcode);
}
我不确定条形码字符串中应包含多少内容,以便扫描仪读取它?:
还是我弄错了吗?
我的引用是:
特别是“链接1”,因为我已经用扫描仪测试了该结果,并且可以正常工作。可悲的是,我无法使输出看起来像这样。