【发布时间】:2017-08-10 01:32:24
【问题描述】:
我们使用ZXing.Net生成code 128条码,一切正常。
BarcodeWriter writer = new BarcodeWriter { Format = BarcodeFormat.CODE_128 };
writer.Write("01950123456789031000012317150801").Save("code128.png", ImageFormat.Png);
最近有人要求我们将格式更改为 GS1-128,经过一番研究,我们发现了使用 FNC1 (ASCII 29) 编写 DataMatrix GS1 的解决方案。 https://stackoverflow.com/a/43575418/823247
BarcodeWriter writer = new BarcodeWriter { Format = BarcodeFormat.DATA_MATRIX };
writer.Write($"{(char)29}019501234567890310000123{(char)29}17150801").Save("gs1datamatrix.png", ImageFormat.Png);
但是,如果我们将条形码格式更改为BarcodeFormat.CODE_128,程序将抛出显示Bad character in input:的异常
BarcodeWriter writer = new BarcodeWriter { Format = BarcodeFormat.CODE_128 };
writer.Write($"{(char)29}019501234567890310000123{(char)29}17150801").Save("gs1code128.png", ImageFormat.Png);
我们将不胜感激。
【问题讨论】: