【发布时间】:2018-11-05 10:43:34
【问题描述】:
我正在尝试使用 ZXing 制作条形码,但我无法强制它使用 CODE_A 或 CODE_B 我试过了:
BarcodeWriter w = new BarcodeWriter();
w.Format = BarcodeFormat.CODE_128;
w.Options.GS1Format = false;
w.Options.Width = 1;
w.Options.Height = (int)(Heightmm * (g.DpiY / 25.4f));
Bitmap img = w.Write("0123456789");
生成 CODE_C 条码
然后用 CODE_A char (103) (Acording to Wikipedia) 加星标:
BarcodeWriter w = new BarcodeWriter();
w.Format = BarcodeFormat.CODE_128;
w.Options.GS1Format = false;
w.Options.Width = 1;
w.Options.Height = (int)(Heightmm * (g.DpiY / 25.4f));
Bitmap img = w.Write((char)103 +"0123456789");
但是只插入一个“g”(在 CODE_B 中)更改为 CODE_C 并插入“0123456789”
我也尝试过使用 end Code A char (106)
BarcodeWriter w = new BarcodeWriter();
w.Format = BarcodeFormat.CODE_128;
w.Options.GS1Format = false;
w.Options.Width = 1;
w.Options.Height = (int)(Heightmm * (g.DpiY / 25.4f));
Bitmap img = w.Write((char)103 +"0123456789" + (char)106);
但是这次生成的条码只在末尾插入了一个j
正确的做法是什么?
【问题讨论】:
-
您只能尝试以下方法。也许这是您正在寻找的:
var writer = new BarcodeWriter { Options = new Code128EncodingOptions { ForceCodesetB = true }, Format = BarcodeFormat.CODE_128 };