GS1-128
IronBarcode GS1 UCC/EAN-128 Sembolojisini Destekliyor mu?
GS1'li barkodlar doğru bir şekilde tanınır ve çözülür. Ancak, sorun, görüntülenen barkod değerinde parantezlerin eksikliğindedir.
GS1-128 kullanırken, IronBarcode şu çıktıyı verir: 01950123456789033103000123 (bu, GS1 imzası olan bir Code 128 barkodu olarak tanınır). Görüntü çıktısında gösterilmesi istenen değer şu olacaktır: 01950123456789033103000123. Ancak, barkod tarayıcı, barkod türünü Code128 olarak algılayarak (01)95012345678903(3103)000123 çıktısını verecektir.
Bir GS1-128 barkodu üretmek 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
Çıktı barkodu

Yukarıdaki kod, varsayılan ayırıcı ile bir GS1-128 barkodu üretir. Ek ayrıcılar eklemek istiyorsanız, Unicode ayırıcısını \u00f1 ekleyebilirsiniz. Ancak, AddBarcodeValueTextBelowBarcode metodunu kullanırken, Unicode karakteri ñ (kod 0x00F1) gösterileceğini unutmayın. Bu sınırlamayı aşmak için alternatif bir yaklaşım, diziyi manipüle edip değiştirilmiş değeri AddAnnotationTextBelowBarcode metoduna geçirmektir. Bu şekilde, ñ karakteri olmadan barkod değerinin istenen görüntülemesine ulaşabilirsiniz.
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
Çıktı barkodu

Barkod tarandığında, çıktı (01)95012345678903(3103)000123(00)0000000123300000(00)00012312300000 olacak ve barkod türü GS1Code128 olarak algılanacaktır.
GS1-128 Kodlamasını Analiz Et
IronBarcode ayrıca GS1-128 barkodunun fiziksel kodlamasını analiz edebilir ve verinin her bir segmenti için hangi Code 128 karakter setlerinin (A, B veya C) kullanıldığını gösterebilir. Kodlama analizi içeren bir GS1 dizesini ayrıştırmak için Code128GS1Parser.ParseWithEncoding metodunu 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 verileri büyük ölçüde sayısal olduğu için, kodlayıcı maksimum sıkışıklık için Code C kullanır. HasEncodingInfo özelliği, sonuçta kodlama analizinin mevcut olduğunu doğrular.

