IronBarcode 故障排除 GS1-128 GS1-128 Curtis Chau 已更新:六月 1, 2025 下载 IronBarcode NuGet 下载 DLL 下载 免费试用 法学硕士副本 法学硕士副本 将页面复制为 Markdown 格式,用于 LLMs 在 ChatGPT 中打开 向 ChatGPT 咨询此页面 在双子座打开 向 Gemini 询问此页面 在双子座打开 向 Gemini 询问此页面 打开困惑 向 Perplexity 询问有关此页面的信息 分享 在 Facebook 上分享 分享到 X(Twitter) 在 LinkedIn 上分享 复制链接 电子邮件文章 This article was translated from English: Does it need improvement? Translated View the article in English IronBarcode 是否支持 GS1 UCC/EAN-128 条码体系? 采用 GS1 标准的条形码能够被准确识别和解码。 然而,问题在于目前显示的条形码值缺少括号。 使用 GS1-128 时,IronBarcode 目前输出: 01950123456789033103000123 (被识别为带有 GS1 签名的 Code 128 条形码)。 图像输出上要显示的值应为: 01950123456789033103000123 。 但是,条形码扫描器将输出(01)95012345678903(3103)000123 ,检测到的条形码类型为Code128 。 要生成 GS1-128 条形码,请使用以下代码: using IronBarCode; class BarcodeExample { static void Main() { // Create a GS1-128 barcode using the specified value GeneratedBarcode barcode = BarcodeWriter.CreateBarcode("01950123456789033103000123", BarcodeWriterEncoding.Code128GS1); // Add the barcode value text below the barcode on the generated image barcode.AddBarcodeValueTextBelowBarcode(); // Save the barcode image as a PNG file barcode.SaveAsPng("gs1code128.png"); } } using IronBarCode; class BarcodeExample { static void Main() { // Create a GS1-128 barcode using the specified value GeneratedBarcode barcode = BarcodeWriter.CreateBarcode("01950123456789033103000123", BarcodeWriterEncoding.Code128GS1); // Add the barcode value text below the barcode on the generated image barcode.AddBarcodeValueTextBelowBarcode(); // Save the barcode image as a PNG file barcode.SaveAsPng("gs1code128.png"); } } Imports IronBarCode Friend Class BarcodeExample Shared Sub Main() ' Create a GS1-128 barcode using the specified value Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode("01950123456789033103000123", BarcodeWriterEncoding.Code128GS1) ' Add the barcode value text below the barcode on the generated image barcode.AddBarcodeValueTextBelowBarcode() ' Save the barcode image as a PNG file barcode.SaveAsPng("gs1code128.png") End Sub End Class $vbLabelText $csharpLabel 输出条形码 ! 输出条形码示例 上述代码生成带有默认分隔符的 GS1-128 条形码。 如果要添加其他分隔符,可以插入 Unicode 分隔符\u00f1 。 但是请注意,使用AddBarcodeValueTextBelowBarcode方法时,将显示 Unicode 字符 ñ(代码 0x00F1)。 为了克服这一限制,另一种方法是操作字符串并将修改后的值传递给AddAnnotationTextBelowBarcode方法。 这样,您就可以在不显示 ñ 字符的情况下实现所需的条形码值显示。 using IronBarCode; class BarcodeExampleWithAnnotation { static void Main() { // Original barcode value string barcodeValue = "0195012345678903310300012300\u00f10000000123300000\u00f10000012312300000"; // Remove unwanted unicode characters for display purposes string trimmedString = barcodeValue.Replace("\u00f1", ""); // Create a GS1-128 barcode using the original value GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(barcodeValue, BarcodeWriterEncoding.Code128GS1); // Add a custom annotation text below the barcode with the trimmed value barcode.AddAnnotationTextBelowBarcode(trimmedString); // Save the barcode image as a PNG file barcode.SaveAsPng("gs1code128.png"); } } using IronBarCode; class BarcodeExampleWithAnnotation { static void Main() { // Original barcode value string barcodeValue = "0195012345678903310300012300\u00f10000000123300000\u00f10000012312300000"; // Remove unwanted unicode characters for display purposes string trimmedString = barcodeValue.Replace("\u00f1", ""); // Create a GS1-128 barcode using the original value GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(barcodeValue, BarcodeWriterEncoding.Code128GS1); // Add a custom annotation text below the barcode with the trimmed value barcode.AddAnnotationTextBelowBarcode(trimmedString); // Save the barcode image as a PNG file barcode.SaveAsPng("gs1code128.png"); } } Imports IronBarCode Friend Class BarcodeExampleWithAnnotation Shared Sub Main() ' Original barcode value Dim barcodeValue As String = "0195012345678903310300012300" & ChrW(&H00f1).ToString() & "0000000123300000" & ChrW(&H00f1).ToString() & "0000012312300000" ' Remove unwanted unicode characters for display purposes Dim trimmedString As String = barcodeValue.Replace(ChrW(&H00f1).ToString(), "") ' Create a GS1-128 barcode using the original value Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(barcodeValue, BarcodeWriterEncoding.Code128GS1) ' Add a custom annotation text below the barcode with the trimmed value barcode.AddAnnotationTextBelowBarcode(trimmedString) ' Save the barcode image as a PNG file barcode.SaveAsPng("gs1code128.png") End Sub End Class $vbLabelText $csharpLabel 输出条形码 ! 输出带注释的条形码示例 扫描条形码时,输出结果为(01)95012345678903(3103)000123(00)0000000123300000(00)00012312300000 ,条形码类型将被检测为GS1Code128 。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? Nuget 下载 1,979,979 | Version: 2025.11 刚刚发布 免费 NuGet 下载 总下载量:1,979,979 查看许可证