GS1-128

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 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
$vbLabelText   $csharpLabel

출력 바코드

BARCODE 출력 예시

위의 코드는 기본 구분 기호가 있는 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
$vbLabelText   $csharpLabel

출력 바코드

주석이 포함된 BARCODE 출력 예시

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
$vbLabelText   $csharpLabel

GS1-128 데이터는 주로 숫자이므로, 인코더는 최대한의 압축성을 위해 코드 C를 사용합니다. HasEncodingInfo 속성은 결과에 인코딩 분석이 적용되었음을 확인합니다.

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.

시작할 준비 되셨나요?
Nuget 다운로드 2,169,908 | 버전: 2026.4 방금 출시되었습니다
Still Scrolling Icon

아직도 스크롤하고 계신가요?

빠른 증거를 원하시나요? PM > Install-Package BarCode
샘플을 실행하세요 실이 바코드로 변하는 모습을 지켜보세요.