Golang: GS1条形码生成

huangapple go评论162阅读模式
英文:

Golang: GS1 Barcode Generation

问题

你好,我正在尝试在Go语言中生成GS1-128条形码。目前,我能够将其呈现为GS1-128条形码,但扫描时它被识别为Code-128条形码,并且它的内容中有<FNC1>而不是(

encoded, _ := code128.Encode("(343)12332(23)32123123")
key := barcode.Register(encoded)
var width = 72.0
var height = 15.0
barcode.Barcode(pdf, key, 50, 50, width, height, false)

有什么想法吗?

英文:

Hello i am trying to generate a GS1-128 Barcode in golang and currently i am able to get it to render the same as a GS1-128 Barcode but it scans as code-128 barcode and it has <FNC1> instead of (

encoded, _ := code128.Encode("(343)12332(23)32123123")
key := barcode.Register(encoded)
var width = 72.0
var height = 15.0
barcode.Barcode(pdf, key, 50, 50, width, height, false)

Any ideas?

答案1

得分: 4

GS1-128是Code128的一种形式。GS1只是在Code128符号中使用了一种特定的数据编码方式。对于你的示例文本(343)12332(23)32123123,括号中的数字是应用标识符,用于指示如何解释后面的数据值。而这些括号是为了在条形码下方显示人类可读的文本。实际的条形码使用代码来指示下一组数字是一个应用标识符。

不幸的是,343是一个无效的应用标识符,所以无法进一步解析你的示例。

如果你想要将你的条形码与一个验证条形码生成器进行比较,你可以使用bwip-js的公共API(我是bwip-js的作者)。以下是你的示例文本的URL:

https://api-bwipjs.metafloor.com/?bcid=gs1-128&text=(343)12332(23)32123123&includetext&padding=10

英文:

GS1-128 is code128. GS1 just uses a specific encoding of the data within the code128 symbology. For your example text, (343)12332(23)32123123, the numbers in parentheses are application-identifiers that indicate how to interpret the following data value. And those parentheses are for the human-readable text displayed below the barcode. The actual barcode uses the <FNC1> code to indicate that the next set of numbers are an application identifier.

Unfortunately, 343 is an invalid AI, so it is not possible to dissect your example any further.

If you would like to compare your barcodes with a validating barcode generator, you can use the bwip-js public API (I am the author of bwip-js). The following is the URL for your example text:

https://api-bwipjs.metafloor.com/?bcid=gs1-128&text=(343)12332(23)32123123&includetext&padding=10

huangapple
  • 本文由 发表于 2023年8月9日 09:32:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76864028.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定