Take the following steps to create and run a program that uses the LEADTOOLS Barcode read activity to recognize barcodes in an image:
[C#]
unlockSupportActivity1.UnlockedFeatures.Add(Leadtools.Workflow.Raster.RasterSupportType.Barcodes1D, "Replace with your own key here");
barcodeReadActivity1.MajorType = Leadtools.Workflow.Barcode.BarcodeMajorTypeFlags.Barcodes1d;
barcodeReadActivity1.SearchType = Leadtools.Workflow.Barcode.BarcodeSearchTypeFlags.Barcode1dReadAnyType;
barcodeReadActivity1.BarColor = Color.Black;
barcodeReadActivity1.SpaceColor = Color.White;
[Visual Basic]
unlockSupportActivity1.UnlockedFeatures.Add(Leadtools.Workflow.Raster.RasterSupportType.Barcodes1D, "Replace with your own key here")
barcodeReadActivity1.MajorType = Leadtools.Workflow.Barcode.BarcodeMajorTypeFlags.Barcodes1d
barcodeReadActivity1.SearchType = Leadtools.Workflow.Barcode.BarcodeSearchTypeFlags.Barcode1dReadAnyType
barcodeReadActivity1.BarColor = Color.Black
barcodeReadActivity1.SpaceColor = Color.White
[C#]
private string GetDataString(byte[] data)
{
string result = string.Empty;
for (int i = 0; i < data.Length; i++)
result = result + Convert.ToChar(data[i]).ToString();
return result;
}
[Visual Basic]
Private Function GetDataString(ByVal data As Byte()) As String
Dim result As String = String.Empty
Dim i As Integer = 0
Do While i < data.Length
result = result & Convert.ToChar(data(i)).ToString()
i += 1
Loop
Return result
End Function
[C#]
if (barcodeReadActivity1.BarcodeData.Count > 0)
{
for (int i = 0; i < barcodeReadActivity1.BarcodeData.Count; i++)
Console.WriteLine(GetDataString(barcodeReadActivity1.BarcodeData[i].Data));
}
else
Console.WriteLine("No barcodes were recognized.");
[Visual Basic]
If barcodeReadActivity1.BarcodeData.Count > 0 Then
Dim i As Integer = 0
Do While i < barcodeReadActivity1.BarcodeData.Count
Console.WriteLine(GetDataString(barcodeReadActivity1.BarcodeData(i).Data))
i += 1
Loop
Else
Console.WriteLine("No barcodes were recognized.")
End If