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 çıktıyı verecektir: 01950123456789033103000123 (bu, GS1 imzasına sahip bir Code 128 barkodu olarak tanınır). Görüntü çıktısında gösterilmesi istenen değer: 01950123456789033103000123 olacaktır. Ancak, barkod tarayıcı (01)95012345678903(3103)000123 çıktısını verecek ve barkod tipi Code128 olarak tespit edilecektir.
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 ekleyebilirsiniz. Ancak, AddBarcodeValueTextBelowBarcode yöntemi kullanıldığında, Unicode karakteri ñ (kod 0x00F1) gösterileceğine dikkat edin. Bu sınırlamayı aşmak için, alternatif bir yaklaşım olarak dizeyi manipüle etmek ve değiştirilmiş değeri AddAnnotationTextBelowBarcode yöntemine aktarmak önerilmektedir. 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

Barkod tarandığında, çıktı (01)95012345678903(3103)000123(00)0000000123300000(00)00012312300000 olacak ve barkod tipi GS1Code128 olarak tespit edilecektir.
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 edilerek bir GS1 dizgesini 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ç üzerinde kodlama analizinin mevcut olduğunu teyit eder.

