VintaSoft Barcode .NET SDK 16.0: Руководство для .NET разработчика
Vintasoft.Barcode.SymbologySubsets Namespace / Code39ExtendedBarcodeSymbology Class
Члены типа Объект Синтаксис Пример Иерархия Требования Смотрите также
В этом разделе
Класс Code39ExtendedBarcodeSymbology
В этом разделе
Определяет расширенную символику штрих-кода Code39 - подмножество символики штрих-кода Code 39.
Объектная модель
BarcodeSymbologySubset Code39ExtendedBarcodeSymbology
Синтаксис
'Declaration

Public Class Code39ExtendedBarcodeSymbology
   Inherits BarcodeSymbologySubset

public class Code39ExtendedBarcodeSymbology : BarcodeSymbologySubset

Пример

Вот C#/VB.NET код, который демонстрирует, как сгенерировать или распознать штрих-код Code39 Extended.

   
''' <summary>
''' Generates an image of Code 39 Extended barcode with specified value.
''' </summary>
Public Shared Function Generate(value As String) As VintasoftBitmap   
    ' create barcode writer
    Using writer As New BarcodeWriter()   
        ' encode Code39 Extended value
        BarcodeSymbologySubsets.Code39Extended.Encode(value, writer.Settings)   
   
        ' create barcode image
        Return writer.GetBarcodeAsVintasoftBitmap()   
    End Using   
End Function   
   
''' <summary>
''' Recognizes the Code 39 Extended barcode in specified image.
''' </summary>
Public Shared Sub Recognize(image As VintasoftBitmap)   
    ' create the barcode reader
    Using reader As New BarcodeReader()   
        ' specify that reader must search for Code39 Extended barcodes only
   
        reader.Settings.ScanBarcodeTypes = BarcodeType.None   
        reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.Code39Extended)   
   
        ' recognize barcode in image
        Dim infos As IBarcodeInfo() = reader.ReadBarcodes(image)   
   
        ' for each found barcode
        For j As Integer = 0 To infos.Length - 1   
            Dim info As BarcodeSubsetInfo = DirectCast(infos(j), BarcodeSubsetInfo)   
   
            ' print barcode value
            Console.WriteLine(String.Format("{0} value: {1}", info.BarcodeSubset, info.Value))   
        Next   
    End Using   
End Sub


/// <summary>
/// Generates an image of Code 39 Extended barcode with specified value.
/// </summary>
public static VintasoftBitmap Generate(string value)
{
    // create barcode writer
    using (BarcodeWriter writer = new BarcodeWriter())
    {
        // encode Code39 Extended value
        BarcodeSymbologySubsets.Code39Extended.Encode(value, writer.Settings);

        // create barcode image
        return writer.GetBarcodeAsVintasoftBitmap();
    }
}

/// <summary>
/// Recognizes the Code 39 Extended barcode in specified image.
/// </summary>
public static void Recognize(VintasoftBitmap image)
{
    // create the barcode reader
    using (BarcodeReader reader = new BarcodeReader())
    {
        // specify that reader must search for Code39 Extended barcodes only

        reader.Settings.ScanBarcodeTypes = BarcodeType.None;
        reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.Code39Extended);

        // recognize barcode in image
        IBarcodeInfo[] infos = reader.ReadBarcodes(image);

        // for each found barcode
        for (int j = 0; j < infos.Length; j++)
        {
            BarcodeSubsetInfo info = (BarcodeSubsetInfo)infos[j];

            // print barcode value
            Console.WriteLine(string.Format("{0} value: {1}", info.BarcodeSubset, info.Value));
        }
    }
}

Иерархия наследования

System.Object
   Vintasoft.Barcode.BarcodeSymbology
      Vintasoft.Barcode.SymbologySubsets.BarcodeSymbologySubset
         Vintasoft.Barcode.SymbologySubsets.Code39ExtendedBarcodeSymbology

Требования

Целевые платформы: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

Смотрите также