'Declaration Public Class HibcLicValueItem Inherits ValueItemBase
public class HibcLicValueItem : ValueItemBase
public __gc class HibcLicValueItem : public ValueItemBase*
public ref class HibcLicValueItem : public ValueItemBase^
This C#/VB.NET code shows how to generate and recognize HIBC LIC barcode:
Imports Vintasoft.Barcode Imports Vintasoft.Barcode.BarcodeInfo Imports Vintasoft.Barcode.SymbologySubsets Imports Vintasoft.Imaging Class HIBCLICExample ''' <summary> ''' Generates and recognizes HIBC LIC 128 Primary barcode. ''' </summary> Public Shared Sub TestHibcLic128PrimaryBarcode() ' create HIBC LIC Primary data Dim primaryData As New HibcLicPrimaryDataStructure("A123", "BJC5D6E7", 1) ' create HIBC LIC barcode value Dim barcodeValue As New HibcLicValueItem(primaryData) ' create barcode writer Using writer As New BarcodeWriter() ' encode ISBT 128 Data Matrix barcode to writer settings BarcodeSymbologySubsets.HIBCLIC128.Encode(barcodeValue, writer.Settings) ' generate barcode image Using barcodeImage As VintasoftBitmap = writer.GetBarcodeAsVintasoftBitmap() ' recognize barcode value Dim recognizedValue As HibcLicValueItem = Recognize(barcodeImage) ' check value If barcodeValue.ToString() <> recognizedValue.ToString() Then Throw New ApplicationException() End If ' privt value PrintValue(recognizedValue) End Using End Using End Sub ''' <summary> ''' Generates and recognizes HIBC LIC 128 Secondary barcode. ''' </summary> Public Shared Sub TestHibcLic128SecondaryBarcode() ' create HIBC LIC Secondary data Dim secondaryData As New HibcLicSecondaryDataStructure("200116", "YYMMDD", "10X3", Nothing) ' create HIBC LIC barcode value, used lick characer 'G' - check character from primary data Dim barcodeValue As New HibcLicValueItem(secondaryData, "G"C) ' create barcode writer Using writer As New BarcodeWriter() ' encode ISBT 128 Data Matrix barcode to writer settings BarcodeSymbologySubsets.HIBCLIC128.Encode(barcodeValue, writer.Settings) ' generate barcode image Using barcodeImage As VintasoftBitmap = writer.GetBarcodeAsVintasoftBitmap() ' recognize barcode value Dim recognizedValue As HibcLicValueItem = Recognize(barcodeImage) ' check value If barcodeValue.ToString() <> recognizedValue.ToString() Then Throw New ApplicationException() End If ' privt value PrintValue(recognizedValue) End Using End Using End Sub ''' <summary> ''' Generates and recognizes HIBC LIC Data Matrix barcode. ''' </summary> Public Shared Sub TestHibcLicDataMatrixBarcode() ' create HIBC LIC Primary data Dim primaryData As New HibcLicPrimaryDataStructure("A123", "BJC5D6E7", 1) ' create HIBC LIC Secondary data Dim secondaryData As New HibcLicSecondaryDataStructure("210116", "YYMMDD", "10X3", Nothing) ' Additional Supplemental Data - date of manufacture Dim manufactureDateAdditionalData As New HibcLicManufactureDateAdditionalDataStructure(DateTime.Now) ' Additional Supplemental Data - quantity Dim quantityAdditionalData As New HibcLicQuantityAdditionalDataStructure(100) ' Additional Supplemental Data - quantity Dim serialNumberAdditionalData As New HibcLicSerialNumberAdditionalDataStructure("77DEFG45") ' create HIBC LIC barcode value Dim barcodeValue As New HibcLicValueItem(primaryData, secondaryData, manufactureDateAdditionalData, serialNumberAdditionalData, quantityAdditionalData) ' create barcode writer Using writer As New BarcodeWriter() ' encode ISBT 128 Data Matrix barcode to writer settings BarcodeSymbologySubsets.HIBCLICDataMatrix.Encode(barcodeValue, writer.Settings) ' generate barcode image Using barcodeImage As VintasoftBitmap = writer.GetBarcodeAsVintasoftBitmap() ' recognize barcode value Dim recognizedValue As HibcLicValueItem = Recognize(barcodeImage) ' check value If barcodeValue.ToString() <> recognizedValue.ToString() Then Throw New ApplicationException() End If ' privt value PrintValue(recognizedValue) End Using End Using End Sub ''' <summary> ''' Recognizes the HIBC LIC barcode from image. ''' </summary> ''' <param name="barcodeImage">The barcode image.</param> Private Shared Function Recognize(barcodeImage As VintasoftBitmap) As HibcLicValueItem ' create barcode reader Using reader As New BarcodeReader() reader.Settings.ScanDirection = ScanDirection.Vertical Or ScanDirection.Horizontal reader.Settings.AutomaticRecognition = True ' specify that HIBC LIC barcodes must be recognizeds reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLIC128) reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLIC39) reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLICAztecCode) reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLICDataMatrix) reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLICQRCode) ' recognize barcodes Dim info As IBarcodeInfo = reader.ReadBarcodes(barcodeImage)(0) ' return HIBC LIC value Return DirectCast(info, HibcLicBarcodeInfo).HibcLicValue End Using End Function ''' <summary> ''' Prints HIBC LIC barcode value. ''' </summary> ''' <param name="value">The recognized value.</param> Private Shared Sub PrintValue(value As HibcLicValueItem) ' print value Console.WriteLine("Barcode value: " & value.ToString()) If value.PrimaryDataStructure IsNot Nothing AndAlso value.SecondaryDataStructure IsNot Nothing Then Console.WriteLine("Data structure: Primary + Secondary") ElseIf value.PrimaryDataStructure IsNot Nothing Then Console.WriteLine("Data structure: Primary") Else Console.WriteLine("Data structure: Secondary") End If If value.PrimaryDataStructure IsNot Nothing Then Console.WriteLine(String.Format("LIC: {0}", value.PrimaryDataStructure.Lic)) Console.WriteLine(String.Format("Product ID: {0}", value.PrimaryDataStructure.Pcn)) Console.WriteLine(String.Format("Unit of Measure: {0}", value.PrimaryDataStructure.UnitOfMeasureID)) End If If value.SecondaryDataStructure IsNot Nothing Then If value.SecondaryDataStructure.ExpiryDateString IsNot Nothing Then Console.WriteLine(String.Format("Expiry date: {0} ({1}={2})", value.SecondaryDataStructure.ExpiryDate.ToShortDateString(), value.SecondaryDataStructure.ExpiryDateStringFormat, value.SecondaryDataStructure.ExpiryDateString)) End If If value.SecondaryDataStructure.LotNumber IsNot Nothing Then Console.WriteLine(String.Format("Lot number: {0}", value.SecondaryDataStructure.LotNumber)) End If If value.SecondaryDataStructure.SerialNumber IsNot Nothing Then Console.WriteLine(String.Format("Serial number: {0}", value.SecondaryDataStructure.SerialNumber)) End If If value.PrimaryDataStructure Is Nothing Then Console.WriteLine(String.Format("Link character: {0}", value.LinkCharacter)) End If End If If value.AdditionalData IsNot Nothing Then For Each additionalData As HibcLicAdditionalDataStructure In value.AdditionalData If TypeOf additionalData Is HibcLicSerialNumberAdditionalDataStructure Then Console.WriteLine(String.Format("Serial number: {0}", DirectCast(additionalData, HibcLicSerialNumberAdditionalDataStructure).SerialNumber)) End If If TypeOf additionalData Is HibcLicManufactureDateAdditionalDataStructure Then Console.WriteLine(String.Format("Manufacture date: {0}", DirectCast(additionalData, HibcLicManufactureDateAdditionalDataStructure).ManufactureDate.ToShortDateString())) End If If TypeOf additionalData Is HibcLicExpiryDateAdditionalDataStructure Then Console.WriteLine(String.Format("Expiry date: {0}", DirectCast(additionalData, HibcLicExpiryDateAdditionalDataStructure).ExpiryDate.ToShortDateString())) End If If TypeOf additionalData Is HibcLicQuantityAdditionalDataStructure Then Console.WriteLine(String.Format("Quantity: {0}", DirectCast(additionalData, HibcLicQuantityAdditionalDataStructure).Quantity)) End If Next End If Console.WriteLine(String.Format("Check character: {0}", value.CheckCharacter)) End Sub End Class
using System; using Vintasoft.Barcode; using Vintasoft.Barcode.BarcodeInfo; using Vintasoft.Barcode.SymbologySubsets; using Vintasoft.Imaging; class HIBCLICExample { /// <summary> /// Generates and recognizes HIBC LIC 128 Primary barcode. /// </summary> public static void TestHibcLic128PrimaryBarcode() { // create HIBC LIC Primary data HibcLicPrimaryDataStructure primaryData = new HibcLicPrimaryDataStructure("A123", "BJC5D6E7", 1); // create HIBC LIC barcode value HibcLicValueItem barcodeValue = new HibcLicValueItem(primaryData); // create barcode writer using (BarcodeWriter writer = new BarcodeWriter()) { // encode ISBT 128 Data Matrix barcode to writer settings BarcodeSymbologySubsets.HIBCLIC128.Encode(barcodeValue, writer.Settings); // generate barcode image using (VintasoftBitmap barcodeImage = writer.GetBarcodeAsVintasoftBitmap()) { // recognize barcode value HibcLicValueItem recognizedValue = Recognize(barcodeImage); // check value if (barcodeValue.ToString() != recognizedValue.ToString()) throw new ApplicationException(); // privt value PrintValue(recognizedValue); } } } /// <summary> /// Generates and recognizes HIBC LIC 128 Secondary barcode. /// </summary> public static void TestHibcLic128SecondaryBarcode() { // create HIBC LIC Secondary data HibcLicSecondaryDataStructure secondaryData = new HibcLicSecondaryDataStructure("200116", "YYMMDD", "10X3", null); // create HIBC LIC barcode value, used lick characer 'G' - check character from primary data HibcLicValueItem barcodeValue = new HibcLicValueItem(secondaryData, 'G'); // create barcode writer using (BarcodeWriter writer = new BarcodeWriter()) { // encode ISBT 128 Data Matrix barcode to writer settings BarcodeSymbologySubsets.HIBCLIC128.Encode(barcodeValue, writer.Settings); // generate barcode image using (VintasoftBitmap barcodeImage = writer.GetBarcodeAsVintasoftBitmap()) { // recognize barcode value HibcLicValueItem recognizedValue = Recognize(barcodeImage); // check value if (barcodeValue.ToString() != recognizedValue.ToString()) throw new ApplicationException(); // privt value PrintValue(recognizedValue); } } } /// <summary> /// Generates and recognizes HIBC LIC Data Matrix barcode. /// </summary> public static void TestHibcLicDataMatrixBarcode() { // create HIBC LIC Primary data HibcLicPrimaryDataStructure primaryData = new HibcLicPrimaryDataStructure("A123", "BJC5D6E7", 1); // create HIBC LIC Secondary data HibcLicSecondaryDataStructure secondaryData = new HibcLicSecondaryDataStructure("210116", "YYMMDD", "10X3", null); // Additional Supplemental Data - date of manufacture HibcLicManufactureDateAdditionalDataStructure manufactureDateAdditionalData = new HibcLicManufactureDateAdditionalDataStructure(DateTime.Now); // Additional Supplemental Data - quantity HibcLicQuantityAdditionalDataStructure quantityAdditionalData = new HibcLicQuantityAdditionalDataStructure(100); // Additional Supplemental Data - quantity HibcLicSerialNumberAdditionalDataStructure serialNumberAdditionalData = new HibcLicSerialNumberAdditionalDataStructure("77DEFG45"); // create HIBC LIC barcode value HibcLicValueItem barcodeValue = new HibcLicValueItem( primaryData, secondaryData, manufactureDateAdditionalData, serialNumberAdditionalData, quantityAdditionalData); // create barcode writer using (BarcodeWriter writer = new BarcodeWriter()) { // encode ISBT 128 Data Matrix barcode to writer settings BarcodeSymbologySubsets.HIBCLICDataMatrix.Encode(barcodeValue, writer.Settings); // generate barcode image using (VintasoftBitmap barcodeImage = writer.GetBarcodeAsVintasoftBitmap()) { // recognize barcode value HibcLicValueItem recognizedValue = Recognize(barcodeImage); // check value if (barcodeValue.ToString() != recognizedValue.ToString()) throw new ApplicationException(); // privt value PrintValue(recognizedValue); } } } /// <summary> /// Recognizes the HIBC LIC barcode from image. /// </summary> /// <param name="barcodeImage">The barcode image.</param> private static HibcLicValueItem Recognize(VintasoftBitmap barcodeImage) { // create barcode reader using (BarcodeReader reader = new BarcodeReader()) { reader.Settings.ScanDirection = ScanDirection.Vertical | ScanDirection.Horizontal; reader.Settings.AutomaticRecognition = true; // specify that HIBC LIC barcodes must be recognizeds reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLIC128); reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLIC39); reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLICAztecCode); reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLICDataMatrix); reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.HIBCLICQRCode); // recognize barcodes IBarcodeInfo info = reader.ReadBarcodes(barcodeImage)[0]; // return HIBC LIC value return ((HibcLicBarcodeInfo)info).HibcLicValue; } } /// <summary> /// Prints HIBC LIC barcode value. /// </summary> /// <param name="value">The recognized value.</param> private static void PrintValue(HibcLicValueItem value) { // print value Console.WriteLine("Barcode value: " + value.ToString()); if (value.PrimaryDataStructure != null && value.SecondaryDataStructure != null) Console.WriteLine("Data structure: Primary + Secondary"); else if (value.PrimaryDataStructure != null) Console.WriteLine("Data structure: Primary"); else Console.WriteLine("Data structure: Secondary"); if (value.PrimaryDataStructure != null) { Console.WriteLine(string.Format("LIC: {0}", value.PrimaryDataStructure.Lic)); Console.WriteLine(string.Format("Product ID: {0}", value.PrimaryDataStructure.Pcn)); Console.WriteLine(string.Format("Unit of Measure: {0}", value.PrimaryDataStructure.UnitOfMeasureID)); } if (value.SecondaryDataStructure != null) { if (value.SecondaryDataStructure.ExpiryDateString != null) { Console.WriteLine(string.Format("Expiry date: {0} ({1}={2})", value.SecondaryDataStructure.ExpiryDate.ToShortDateString(), value.SecondaryDataStructure.ExpiryDateStringFormat, value.SecondaryDataStructure.ExpiryDateString)); } if (value.SecondaryDataStructure.LotNumber != null) Console.WriteLine(string.Format("Lot number: {0}", value.SecondaryDataStructure.LotNumber)); if (value.SecondaryDataStructure.SerialNumber != null) Console.WriteLine(string.Format("Serial number: {0}", value.SecondaryDataStructure.SerialNumber)); if (value.PrimaryDataStructure == null) Console.WriteLine(string.Format("Link character: {0}", value.LinkCharacter)); } if (value.AdditionalData != null) { foreach (HibcLicAdditionalDataStructure additionalData in value.AdditionalData) { if (additionalData is HibcLicSerialNumberAdditionalDataStructure) Console.WriteLine(string.Format("Serial number: {0}", ((HibcLicSerialNumberAdditionalDataStructure)additionalData).SerialNumber)); if (additionalData is HibcLicManufactureDateAdditionalDataStructure) Console.WriteLine(string.Format("Manufacture date: {0}", ((HibcLicManufactureDateAdditionalDataStructure)additionalData).ManufactureDate.ToShortDateString())); if (additionalData is HibcLicExpiryDateAdditionalDataStructure) Console.WriteLine(string.Format("Expiry date: {0}", ((HibcLicExpiryDateAdditionalDataStructure)additionalData).ExpiryDate.ToShortDateString())); if (additionalData is HibcLicQuantityAdditionalDataStructure) Console.WriteLine(string.Format("Quantity: {0}", ((HibcLicQuantityAdditionalDataStructure)additionalData).Quantity)); } } Console.WriteLine(string.Format("Check character: {0}", value.CheckCharacter)); } }
System.Object
 Vintasoft.Barcode.BarcodeInfo.ValueItemBase
   Vintasoft.Barcode.BarcodeInfo.HibcLicValueItem
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5