GS1-128

This article was translated from English: Does it need improvement?
Translated
View the article in English

Unterstützt IronBarcode die GS1 UCC/EAN-128-Symbologie?

Barcodes mit GS1 werden genau erkannt und dekodiert. Das Problem liegt jedoch im aktuellen Fehlen von Klammern im angezeigten Barcode-Wert.

Bei der Verwendung von GS1-128 gibt IronBarcode derzeit aus: 01950123456789033103000123 (was als Code 128 Barcode mit GS1-Signatur erkannt wird). Der gewünschte Wert, der im Bildausgang angezeigt werden soll, wäre: 01950123456789033103000123. Der Barcodescanner wird jedoch (01)95012345678903(3103)000123 ausgeben mit einer Erkennung des Barcodetyps als Code128.

Zum Generieren eines GS1-128-Barcodes verwenden Sie den folgenden 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

Ausgabe-Barcode

Beispiel für Ausgabe-Barcode

Der obige Code erzeugt einen GS1-128-Barcode mit einem Standardteiler. Wenn Sie zusätzliche Teiler hinzufügen möchten, können Sie den Unicode-Trenner \u00f1 einfügen. Beachten Sie jedoch, dass bei Verwendung der Methode AddBarcodeValueTextBelowBarcode das Unicode-Zeichen ñ (Code 0x00F1) angezeigt wird. Um diese Einschränkung zu überwinden, kann ein alternativer Ansatz darin bestehen, den String zu manipulieren und den modifizierten Wert an die Methode AddAnnotationTextBelowBarcode zu übergeben. Auf diese Weise können Sie die gewünschte Anzeige des Barcode-Wertes ohne das ñ-Zeichen erreichen.

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

Ausgabe-Barcode

Ausgabe-Barcode mit Annotationsbeispiel

Beim Scannen des Barcodes wird folgender Wert ausgegeben: (01)95012345678903(3103)000123(00)0000000123300000(00)00012312300000, und der Barcode-Typ wird als GS1Code128 erkannt.

Curtis Chau
Technischer Autor

Curtis Chau hat einen Bachelor-Abschluss in Informatik von der Carleton University und ist spezialisiert auf Frontend-Entwicklung mit Expertise in Node.js, TypeScript, JavaScript und React. Leidenschaftlich widmet er sich der Erstellung intuitiver und ästhetisch ansprechender Benutzerschnittstellen und arbeitet gerne mit modernen Frameworks sowie der Erstellung gut strukturierter, optisch ansprechender ...

Weiterlesen
Bereit anzufangen?
Nuget Downloads 1,935,276 | Version: 2025.11 gerade veröffentlicht