IronBarcode 故障排除 GS1-128 GS1-128 Curtis Chau 已更新:六月 1, 2025 Download IronBarcode NuGet 下载 DLL 下载 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article This article was translated from English: Does it need improvement? Translated View the article in English Does IronBarcode Support GS1 UCC/EAN-128 Symbology? Barcodes with GS1 are recognized and decoded accurately. However, the issue lies in the current lack of brackets in the displayed barcode value. When using GS1-128, IronBarcode currently outputs: 01950123456789033103000123 (which is recognized as a Code 128 barcode with GS1 signature). The desired value to be displayed on the image output would be: 01950123456789033103000123. However, the barcode scanner will output (01)95012345678903(3103)000123 with a detection of the barcode type as Code128. For generating a GS1-128 barcode, use the following code: 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 Output barcode The above code generates a GS1-128 barcode with a default divider. If you want to add additional dividers, you can insert the Unicode separator \u00f1. However, note that when using the AddBarcodeValueTextBelowBarcode method, the Unicode character ñ (code 0x00F1) will be displayed. To overcome this limitation, an alternative approach is to manipulate the string and pass the modified value to the AddAnnotationTextBelowBarcode method. This way, you can achieve the desired display of the barcode value without the ñ character. 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 Output barcode When scanning the barcode, the output will be (01)95012345678903(3103)000123(00)0000000123300000(00)00012312300000, and the barcode type will be detected as GS1Code128. Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? Nuget 下载 1,935,276 | 版本: 2025.11 刚刚发布 免费 NuGet 下载 总下载量:1,935,276 查看许可证