跳至页脚内容
条形码工具

Generate GS1-Compliant Barcodes Easily with IronBarcode

通过嵌入结构化数据格式,GS1 条码标准化供应链中的产品识别和可追溯性。 开发人员可以使用IronBarcode生成GS1-128、DataMatrix或其他合规条码,利用预定义的应用标识符(AIs)和严格的语法规则。

本指南详细介绍了编程生成条码的逐步过程,包括如何嵌入 FNC1 控制字符并验证校验和以符合 ISO/IEC 规范。 在零售、制造或分销工作流程中实施 GS1 标准的企业可以获得更好的系统集成、减少手动数据错误和更快的库存周转。

什么是GS1条码?

损坏的图像 从Pixabay添加,选择你的文件或拖放图像到此处。

GS1条码是标准化识别系统,为产品分配唯一的全球贸易项目编号(GTINs),包括通用产品代码(UPC)。 这些代码使全球供应链中的无缝追踪成为可能。 GS1条码自动化库存管理,减少手动错误,并提高零售、制造和分销产品的可追溯性。 每个消费品变体都会获得一个唯一的GTIN以确保准确跟踪。

它们支持例如 GS1-128 和 DataMatrix 的符号系统,这些符号系统与企业系统集成以简化物流和销售点交易。 GS1条码通过编码结构化数据字段(如批号和有效日期)提高数据准确性。 它们还可确保符合行业法规,使其成为现代商业基础设施中不可或缺的一部分。

下面是一个简明的比较表,突出显示不同类型的GS1支持条码及其典型应用。

条码类型 典型用法 数据容量 关键特征
EAN/UPC 零售销售点的消费品变体 最多14位数字(主要是GTIN) 广泛认可; 零售商品中最常见的条码
GS1-128 供应链与物流 可变(可以包括批次、批号和有效期) 灵活的格式; 常常编码附加的产品细节
GS1 DataMatrix 医疗、电子、高价值项目 高容量(可以存储GTIN及附加字段) 非常紧凑; 适合小型产品; 极佳的可追溯性
GS1 QR 码 市场营销与消费者参与 高容量(可以包含GTIN + URLs,等等) 可携带促销信息; 易于智能手机扫描

GS1条码通过促进实时数据捕获和分析推动数字化转型计划,加强供应链可见性和决策。 它们与创新技术(如物联网和区块链)的集成增强了整个产品生命周期的安全性和可追溯性。 这种连接推动了运营效率和成本降低,并提供了关于消费者行为和市场趋势的有价值见解。 它使企业能够创新并在快速发展的全球市场中保持竞争优势。

为什么选择IronBarcode用于GS1条码生成?

轻松使用IronBarcode生成GS1合规条码:图2 - IronBarcode

IronBarcode 提供了强大的工具用于生成GS1合规条码,包括GS1-128、DataMatrix和QR码等格式。 该库严格验证应用标识符(AIs)等关键限定符,并自动计算校验和以符合ISO/IEC要求。 开发人员可以将其集成到.NET应用程序中,以编程方式生成和定制条码或二维码图像。

结构化数据编码包括关键限定符,如批号、有效日期和批号。 这些提高了库存和产品跟踪工作流的准确性。 零售、医疗保健和物流行业使用这些功能来减少手动错误。 它们还增强了与销售点和仓库管理系统的互操作性。 使用在线条码生成器简化了创建GS1合规条码的流程。 对于编程生成,IronBarcode 提供了绝对最佳的结果。

使用IronBarcode生成GS1合规条码的逐步指南

本指南提供了使用 .NET 中的 IronBarcode 库生成 GS1 合规条码(例如GS1-128)的详细演练。 该过程包括安装、条码创建、定制、验证和最佳实践。

1. 安装 IronBarcode 库

要开始GS1条码生成,请使用NuGet Package Manager 将 IronBarcode 安装到您的 .NET 项目中:

Install-Package BarCode
Install-Package BarCode
SHELL

轻松使用IronBarcode生成GS1合规条码:图3 - 安装IronBarcode

或者,您可以从官方网站下载并手动将引用添加到您的项目中。

2. 创建条码

要生成GS1条码,您必须正确定义GTIN并遵循GS1格式标准。 GS1-128条码需要包括括号中的应用标识符(AIs)的结构化数据。 以下是使用 IronBarcode 生成 GS1-128 条码的正确方法:

using IronBarCode;

// Define GS1 barcode content with AI (01) for GTIN
var barcode = BarcodeWriter.CreateBarcode("(01)12345678901231", BarcodeEncoding.Code128GS1);

// Customize barcode settings
barcode.SetMargins(20);
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode");

// Save barcode as an image
barcode.SaveAsPng("gs1_barcode.png");
using IronBarCode;

// Define GS1 barcode content with AI (01) for GTIN
var barcode = BarcodeWriter.CreateBarcode("(01)12345678901231", BarcodeEncoding.Code128GS1);

// Customize barcode settings
barcode.SetMargins(20);
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode");

// Save barcode as an image
barcode.SaveAsPng("gs1_barcode.png");
Imports IronBarCode

' Define GS1 barcode content with AI (01) for GTIN
Private barcode = BarcodeWriter.CreateBarcode("(01)12345678901231", BarcodeEncoding.Code128GS1)

' Customize barcode settings
barcode.SetMargins(20)
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode")

' Save barcode as an image
barcode.SaveAsPng("gs1_barcode.png")
$vbLabelText   $csharpLabel

轻松使用IronBarcode生成GS1合规条码:图4 - GS1条码输出

此实现结果是一种符合 GS1 标准的条码,适用于产品包装、仓库管理和供应链物流。 务必验证 GTIN 并用扫描器测试条码,以确保其正确扫描并确认与库存和销售点系统的兼容性。

3. 定制条码图像

IronBarcode 提供广泛的自定义选项,可以修改条码尺寸、颜色、边距和注释,保持清晰度和品牌一致性。 在所有系统中使用一种条码格式减少了复杂性,而自定义可以改善条码在不同扫描仪和设备中的可读性。

以下是有效定制GS1条码的方法:

// Adjust barcode size for better scanning
barcode.ResizeTo(500, 250);

// Change barcode color to match branding requirements
barcode.ChangeBarCodeColor(System.Drawing.Color.DarkBlue);

// Set margins to ensure clear spacing around the barcode
barcode.SetMargins(20);

// Add annotation text below the barcode for better identification
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode");

// Save barcode in different formats as needed
barcode.SaveAsJpeg("custom_barcode.jpg");
barcode.SaveAsPng("custom_barcode.png");
// Adjust barcode size for better scanning
barcode.ResizeTo(500, 250);

// Change barcode color to match branding requirements
barcode.ChangeBarCodeColor(System.Drawing.Color.DarkBlue);

// Set margins to ensure clear spacing around the barcode
barcode.SetMargins(20);

// Add annotation text below the barcode for better identification
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode");

// Save barcode in different formats as needed
barcode.SaveAsJpeg("custom_barcode.jpg");
barcode.SaveAsPng("custom_barcode.png");
' Adjust barcode size for better scanning
barcode.ResizeTo(500, 250)

' Change barcode color to match branding requirements
barcode.ChangeBarCodeColor(System.Drawing.Color.DarkBlue)

' Set margins to ensure clear spacing around the barcode
barcode.SetMargins(20)

' Add annotation text below the barcode for better identification
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode")

' Save barcode in different formats as needed
barcode.SaveAsJpeg("custom_barcode.jpg")
barcode.SaveAsPng("custom_barcode.png")
$vbLabelText   $csharpLabel

通过自定义这些元素,企业可以优化条码在打印和扫描中的性能,实现GS1标准的合规性和提高操作效率。

4. 保存并验证条码

生成条码后,必须以与打印和数字应用兼容的格式保存。 推荐使用PNG、JPEG和PDF等高分辨率格式,以在调整大小或物理打印期间保持可扫描性。 以下是如何以不同格式保存条码:

// Save barcode as PNG for digital use
barcode.SaveAsPng("final_barcode.png");

// Save barcode as JPEG for printing
barcode.SaveAsJpeg("final_barcode.jpg");

// Save barcode as a PDF for documentation purposes
barcode.SaveAsPdf("final_barcode.pdf");
// Save barcode as PNG for digital use
barcode.SaveAsPng("final_barcode.png");

// Save barcode as JPEG for printing
barcode.SaveAsJpeg("final_barcode.jpg");

// Save barcode as a PDF for documentation purposes
barcode.SaveAsPdf("final_barcode.pdf");
' Save barcode as PNG for digital use
barcode.SaveAsPng("final_barcode.png")

' Save barcode as JPEG for printing
barcode.SaveAsJpeg("final_barcode.jpg")

' Save barcode as a PDF for documentation purposes
barcode.SaveAsPdf("final_barcode.pdf")
$vbLabelText   $csharpLabel

保存后,条码必须经过验证以确认其在不同扫描系统中的机器可读性。 此过程确认符合GS1规范,并减轻了生产环境中的扫描错误。 验证程序通常涉及使用标准条码读取器库进行解码尝试:

// Validate the barcode by attempting to read it
bool isValid = BarcodeReader.Read("final_barcode.png").Any();
Console.WriteLine($"Barcode is valid: {isValid}");
// Validate the barcode by attempting to read it
bool isValid = BarcodeReader.Read("final_barcode.png").Any();
Console.WriteLine($"Barcode is valid: {isValid}");
' Validate the barcode by attempting to read it
Dim isValid As Boolean = BarcodeReader.Read("final_barcode.png").Any()
Console.WriteLine($"Barcode is valid: {isValid}")
$vbLabelText   $csharpLabel

轻松使用IronBarcode生成GS1合规条码:图5 - 验证条码

系统化的验证防止了在供应链管理系统、销售点接口和库存数据库中无法扫描的代码导致的操作中断。 这是一个至关重要的质量控制措施,特别是对于高容量打印操作,其中由于错误更正造成的成本会成倍增加。

结论

轻松使用IronBarcode生成GS1合规条码:图6 - 授权

使用 IronBarcode 生成 GS1 条码是一种简便而有效的方法,可提高产品识别和简化供应链管理。 凭借其强大的功能,企业可以创建符合全球标准的条码,确保从生产到销售点和线上产品的无缝跟踪。

IronBarcode 为开发人员提供免费试用,以便在购买之前探索其功能。 许可证从 $liteLicense 起步,提供了一种经济有效且可扩展的解决方案,适合希望高效实施条码生成的公司。

Jordi Bardia
软件工程师
Jordi 最擅长 Python、C# 和 C++,当他不在 Iron Software 利用这些技能时,他就在游戏编程。分享产品测试、产品开发和研究的责任,Jordi 在持续的产品改进中增加了巨大的价值。多样的经验使他面临挑战并保持投入,他表示这是在 Iron Software 工作的最喜欢的方面之一。Jordi 在佛罗里达州迈阿密长大,并在佛罗里达大学学习计算机科学和统计学。