GS1-128
IronBarcode는 GS1 UCC/EAN-128 심볼로지를 지원하나요?
GS1이 포함된 바코드는 정확하게 인식되고 디코딩됩니다. 그러나 현재 표시되는 바코드 값에 괄호가 없다는 점이 문제입니다.
GS1-128을 사용할 때, IronBarcode는 현재 01950123456789033103000123(GS1 서명이 포함된 Code 128 BARCODE로 인식됨)을 출력합니다. 이미지 출력에 표시될 원하는 값은 다음과 같습니다: 01950123456789033103000123. 그러나 BARCODE 스캐너는 BARCODE 유형을 Code128로 감지하고 (01)95012345678903(3103)000123을 출력합니다.
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
출력 바코드

위의 코드는 기본 구분 기호가 있는 GS1-128 바코드를 생성합니다. 분리선을 추가하려면 유니코드 구분자 \u00f1를 삽입할 수 있습니다. 단, AddBarcodeValueTextBelowBarcode 메서드를 사용할 경우 유니코드 문자 ñ(코드 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
출력 바코드

BARCODE를 스캔하면 출력은 (01)95012345678903(3103)000123(00)0000000123300000(00)00012312300000가 되며, BARCODE 유형은 GS1Code128로 감지됩니다.
GS1-128 인코딩 분석
IronBarcode는 또한 GS1-128 BarCode의 물리적 인코딩을 분석하여, 데이터의 각 세그먼트에 어떤 Code 128 문자 집합(A, B 또는 C)이 사용되었는지 보여줍니다. 인코딩 분석을 포함하여 GS1 문자열을 파싱하려면 Code128GS1Parser.ParseWithEncoding 메서드를 사용하십시오.
using IronBarCode;
// GS1-128 with encoding analysis
var gs1Result = Code128GS1Parser.ParseWithEncoding("(01)09501101530003");
Console.WriteLine(gs1Result.CharacterSetSummary); // "C"
Console.WriteLine(gs1Result.HasEncodingInfo); // true
using IronBarCode;
// GS1-128 with encoding analysis
var gs1Result = Code128GS1Parser.ParseWithEncoding("(01)09501101530003");
Console.WriteLine(gs1Result.CharacterSetSummary); // "C"
Console.WriteLine(gs1Result.HasEncodingInfo); // true
Imports IronBarCode
' GS1-128 with encoding analysis
Dim gs1Result = Code128GS1Parser.ParseWithEncoding("(01)09501101530003")
Console.WriteLine(gs1Result.CharacterSetSummary) ' "C"
Console.WriteLine(gs1Result.HasEncodingInfo) ' True
GS1-128 데이터는 주로 숫자이므로, 인코더는 최대한의 압축성을 위해 코드 C를 사용합니다. HasEncodingInfo 속성은 결과에 인코딩 분석이 적용되었음을 확인합니다.

