How can I generate (encode) GS1-128 or EAN128 barcode?

亡梦爱人 提交于 2019-12-13 01:35:19

问题


I've been working with the netbarcodewriter library from https://github.com/simongh/barcodes and have been able to successfully generate code 128 barcodes. It fails when I try to encode (95)00209(96)0004471(97)0065(98)1931 with the EAN128 using the GS1Builder.

Below is an example in LinqPad:

GS1Builder gs1= new GS1Builder();
// add the AIs
gs1.Add(95,"00209");
gs1.Add(96,"0004471");
gs1.Add(97,"0065");
gs1.Add(98,"1931");
gs1.ToDisplayString().Dump();
var ean128 = new EAN128();
bmp = ean128.Generate(gs1, new BarcodeSettings { BarHeight = 65 });

I get a FormatException in EncodeCodeC when trying int.Parse(value) where value contains FNC1. I know this is likely my lack of understanding of EAN128, but I can't see what I'm missing.

EDIT I have also stripped the FNC1 character before parsing, but I end up with an invalid barcode image.

EDIT 2 When I simply concatenate the AIs and values ((95)00209(96)0004471(97)0065(98)1931 -> 9500209960004471970065981931), and encode that as CODE128 the scanners return the exact same value as a valid EAN128 with the same values. Does that mean that I can modify this to simply encode as Code128, but display friendly human readable text below the image? How can I generate EAN128 barcodes?

Has anyone been able to successfully generate EAN128 barcodes with this libarary?

来源:https://stackoverflow.com/questions/24304804/how-can-i-generate-encode-gs1-128-or-ean128-barcode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!