GS1-128
IronBarcode GS1 UCC/EAN-128 Sembolojisini Destekliyor mu?
GS1 ile barkodlar doğru bir şekilde tanınır ve çözülür. Ancak, mevcut barkod değerinde parantez eksikliği sorunu vardır.
GS1-128 kullanıldığında, IronBarcode şu anda şu çıktıyı vermektedir: 01950123456789033103000123 (bu, GS1 imzalı bir Code 128 BARCODE olarak tanınır). Görüntü çıktısında gösterilmesi istenen değer şudur: 01950123456789033103000123. Ancak, barkod tarayıcı, barkod türünü Code128 olarak algılayarak (01)95012345678903(3103)000123 çıktısını verecektir.
GS1-128 barkodunu oluşturmak için aşağıdaki kodu kullanın:
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
Çıkış barkodu

Yukarıdaki kod, varsayılan bir bölücü ile bir GS1-128 barkod oluşturur. Ek ayırıcılar eklemek isterseniz, Unicode ayırıcı \u00f1'yi ekleyebilirsiniz. Ancak, AddBarcodeValueTextBelowBarcode yöntemini kullanırken Unicode karakteri ñ (kod 0x00F1) görüntüleneceğini unutmayın. Bu sınırlamayı aşmak için alternatif bir yaklaşım, dizgiyi işleyip değiştirilen değeri AddAnnotationTextBelowBarcode yöntemine aktarmaktır. Bu şekilde, barkod değerinin görüntüsünü ñ karakteri olmadan elde edebilirsiniz.
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
Çıkış barkodu

BarCODE tararken, çıktı (01)95012345678903(3103)000123(00)0000000123300000(00)00012312300000 olacak ve BarCODE türü GS1Code128 olarak algılanacaktır.
GS1-128 Kodlamasını Analiz Et
IronBarcode, bir veri segmenti için kullanılan Code 128 karakter setlerini (A, B veya C) göstererek GS1-128 barkodunun fiziksel kodlamasını da analiz edebilir. Kodlama analizi dahil olmak üzere bir GS1 dizesini ayrıştırmak için Code128GS1Parser.ParseWithEncoding yöntemini kullanın.
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 verisi ağırlıklı olarak sayısal olduğundan, kodlayıcı maksimum kompaktlık için Kod C kullanır. HasEncodingInfo özelliği, sonuçta kodlama analizinin mevcut olduğunu doğrular.

