You are here: GdPicture.NET > Documentation > Classes > GdPictureImaging Class > GdPictureImaging Methods > TWAIN Features > TwainBarCodeGetRotation Method
logo.gif
ContentsIndexHome
PreviousUpNext
GdPictureImaging.TwainBarCodeGetRotation Method

Returns the orientation of a bar code found on the last acquired image.

C#
public TwainBarCodeRotation TwainBarCodeGetRotation(
    int BarCodeNo
);
Visual Basic
Public Function TwainBarCodeGetRotation(
    ByVal BarCodeNo As Integer
) As TwainBarCodeRotation
Parameters
Parameters 
Description 
BarCodeNo 
The barcode number. Must be value between 1 and the number of detected barcodes.  
Returns

A member of the TwainBarCodeRotation enumeration.

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.