IronBarcode 故障排除 GS1-128 GS1-128 Curtis Chau 更新日期:6月 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 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 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。 準備好開始了嗎? Nuget 下載 1,935,276 | 版本: 2025.11 剛剛發布 免費 NuGet 下載 總下載量:1,935,276 查看許可證