If barcode detection is enabled, returns the number of bar codes found on the last acquired image.
public int TwainBarCodeGetCount();
Public Function TwainBarCodeGetCount() As Integer
The number of bar codes found on the document image.
A value of 0 means the bar code engine was enabled but that no bar codes were found.
A value of -1 means the bar code engine was not enabled.
Before using this function make sure that the barcode detection was enabled by the TwainSetBarcodeDetection() function.
Use the TwainBarCodeGetCount() function to determine how many barcodes have been detected on the last acquired image.
Acquire single image and detect its barcodes
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click Dim ImageID As Integer Dim oGdPictureImaging As New GdPicture.GdPictureImaging oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a valid demo or commercial license KEY If oGdPictureImaging.TwainOpenDefaultSource(Me.Handle) Then If oGdPictureImaging.TwainIsBarcodeDetectionAvailable Then oGdPictureImaging.TwainSetBarcodeDetection(True) ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle) If ImageID <> 0 Then Dim BarCodeCount As Integer = oGdPictureImaging.TwainBarCodeGetCount MsgBox(Str(BarCodeCount) + " barcode have been found in the scanned image") For i As Integer = 1 To BarCodeCount MsgBox("Type of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetType(i).ToString) MsgBox("Value of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetValue(i)) Next oGdPictureImaging.ReleaseGdPictureImage(ImageID) End If Else MsgBox("Error: Barcode detection is not available on this scanner") End If oGdPictureImaging.TwainCloseSource() MsgBox("Done !") Else MsgBox("can't open default source, twain state is: " & oGdPictureImaging.TwainGetState.ToString) End If End Sub
|
What do you think about this topic? Send feedback!
|
|
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.
|