Leadtools.Twain Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.8.31
GetItem Method
See Also  Example
Leadtools.Twain Namespace > TwainInformation Class : GetItem Method




index
Index into the array of extended image information.
barcodeTextIndex
Additional parameter that contains extended image information.
For example when getting barcode text, the barcode text length will be passed in this parameter.
Gets the specified extended image information item.

Syntax

Visual Basic (Declaration) 
Public Function GetItem( _
   ByVal index As Integer, _
   ByVal barcodeTextIndex As Integer _
) As Object
Visual Basic (Usage)Copy Code
Dim instance As TwainInformation
Dim index As Integer
Dim barcodeTextIndex As Integer
Dim value As Object
 
value = instance.GetItem(index, barcodeTextIndex)
C# 
public object GetItem( 
   int index,
   int barcodeTextIndex
)
Managed Extensions for C++ 
public: Object* GetItem( 
   int index,
   int barcodeTextIndex
) 
C++/CLI 
public:
Object^ GetItem( 
   int index,
   int barcodeTextIndex
) 

Parameters

index
Index into the array of extended image information.
barcodeTextIndex
Additional parameter that contains extended image information.
For example when getting barcode text, the barcode text length will be passed in this parameter.

Return Value

The specified extended image information item, cast as an object.
If an error occurs an exception is thrown.

Example

Visual BasicCopy Code
Public Sub GetItemExample(ByVal parent As IWin32Window)
   Try
      Dim twnSession As TwainSession = New TwainSession()
      twnSession.Startup(parent, "LEAD Technologies, Inc.", "LEAD Twain .NET", "Version 14", "LEADTools Twain test sample", TwainStartupFlags.None)

      Dim twainExtImageInfo As TwainExtraImageInformation = New TwainExtraImageInformation(1)

      twainExtImageInfo.GetInformation(0).InfoId = TwainExtendedImage.BarcodeText
      twainExtImageInfo.GetInformation(0).ItemType = TwainItemType.Uint32

      twnSession.UpdateExtraImageInformation(twainExtImageInfo)

      If twainExtImageInfo.GetInformation(0).ConditionCode = TwainConditionCode.Success Then
         Dim i As Integer = 0
         Do While i < twainExtImageInfo.GetInformation(0).Count
            Dim item As UInteger = CUInt(twainExtImageInfo.GetInformation(0).GetItem(i, 0))
            'Do more processing on the item value
            i += 1
         Loop
      End If

      twnSession.Shutdown()
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try
End Sub
C#Copy Code
public void GetItemExample(IWin32Window parent) 

   try 
   { 
      TwainSession twnSession = new TwainSession(); 
      twnSession.Startup(parent, "LEAD Technologies, Inc.", "LEAD Twain .NET", "Version 14", "LEADTools Twain test sample", TwainStartupFlags.None); 
 
      TwainExtraImageInformation twainExtImageInfo = new TwainExtraImageInformation(1); 
 
      twainExtImageInfo.GetInformation(0).InfoId = TwainExtendedImage.BarcodeText; 
      twainExtImageInfo.GetInformation(0).ItemType = TwainItemType.Uint32; 
 
      twnSession.UpdateExtraImageInformation(twainExtImageInfo); 
 
      if (twainExtImageInfo.GetInformation(0).ConditionCode == TwainConditionCode.Success) 
      { 
         for (int i=0; i < twainExtImageInfo.GetInformation(0).Count; i++) 
         { 
            uint item = (uint)twainExtImageInfo.GetInformation(0).GetItem(i, 0); 
            //Do more processing on the item value 
         } 
      } 
 
      twnSession.Shutdown(); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show(ex.Message); 
   } 
}

Remarks

Extended image information can be Barcode texts, Barcode data, etc.
This method can only be called from within the AcquirePage event.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also