VintaSoft Barcode .NET SDK Discussions
Questions, comments and suggestions concerning VintaSoft Barcode .NET SDK.
Board index < VintaSoft Barcode < VintaSoft Barcode .NET SDK Discussions
' Create a BarcodeReader object
Dim barcodeReader As BarcodeReader = New BarcodeReader()
' Extract only Code 128 barcodes
barcodeReader.Settings.ScanBarcodeTypes = BarcodeType.Code128
' Extract onnly horizontal barcodes
barcodeReader.Settings.ScanDirection = ScanDirection.LeftToRight Or ScanDirection.RightToLeft
' Analyze every 5 row and column
barcodeReader.Settings.ScanInterval = 5
' Extract 10 first barcodes
barcodeReader.Settings.MaxBarcodes = 10
' Manual mode of threshold detection
barcodeReader.Settings.ThresholdMode = ThresholdMode.Manual
' Number of steps between minimal and maximal threshold values
barcodeReader.Settings.ThresholdIterations = 15
' Minimal threshold value
barcodeReader.Settings.Threshold1D = 480
' Maximal threshold value
barcodeReader.Settings.Threshold2D = 550
' Acquire images from scanner and search barcodes in acquired images
Try
' Open the scanning library
VSTwain1.StartDevice()
' Select a scanner
VSTwain1.SelectSource()
' Disable UI
VSTwain1.ShowUI = false
' Acquire images
While VSTwain1.AcquireModal()
' Extract barcodes
Dim Infos() As IBarcodeInfo = barcodeReader.ReadBarcodes(VSTwain1.GetCurrentImage())
' If barcodes are detected
Dim resultString As String
If Infos IsNot Nothing Or Infos.Length > 1 Then
' Get information about extracted barcodes
resultString = "Codes detected" + Infos.Length.ToString() + "]:" + Environment.NewLine
Dim i As Integer
For i = 0 To Infos.Length - 1
resultString += Infos(i).ToString() + Environment.NewLine
Next i
End If
End While
' Close the scanning library
VSTwain1.StopDevice()
MsgBox "Scan completed."
Catch ex As TwainException
MsgBox(ex.Message)
End Try
Best regards, Alexander