ClearImage DLID Reader Send comments on this topic.
Read1D Method
See Also  Example

Description

Read 1D barcode value

Syntax

Visual Basic
Public Function Read1D() As ICiBarcode

Example

Visual BasicCopy Code
' In VB6 Project menu Add Reference to:
' ClearImage COM Server
' ClearImageDLID Reader

Public Sub Read_2D(sFile As String)
  On Error GoTo except
   ' Create Reader
  Dim oReader As New ClearImageDLID.Reader
    ' Open image from file
  oReader.Image.Open sFile
    ' Find barcodes
  Dim Bc As CiBarcode
  Set Bc = oReader.Read2D
    ' Process Results
  If (Not Bc Is Nothing) Then MsgBox Parse_AAMVA(Bc.text)
  If (Bc Is Nothing) Then MsgBox "NO 2D Barcode"
  Exit Sub
except:
  MsgBox "ERROR: " & Err.Description
End Sub


Public Function Parse_AAMVA(text As String) As String
    ' Create Parser
  Dim oParser As New ClearImageDLID.ParserAAMVA
     ' Do Parsing
  If (oParser.Parse(text)) Then
    Dim s As String
     ' Display Results
    s = s & "FileType = " & oParser.FileType & vbCrLf
    s = s & "Issuer Identification Number = " & oParser.Issuer & vbCrLf
    s = s & "AAMVA Ver = " & oParser.AamvaVer & vbCrLf
    s = s & "Jurisdiction Ver = " & oParser.JurisdictionVer & vbCrLf
    s = s & "Number of Entries = " & oParser.NumberOfEntries & vbCrLf

    Dim d As ClearImageDLID.Element
    s = s & " == ELEMENTS ==" & vbCrLf
    For Each d In oParser.Elements
      If (d.isSet) Then
        s = s & d.Description & " [" & d.Id & "] = '" & d.Value & "'" & vbCrLf
      End If
    Next
    Parse_AAMVA = s
  Else
    Parse_AAMVA = oParser.Error
  End If
End Function


C#Copy Code
// In Visual Studio Project menu Add References to COM: 
//    ClearImageDLID Reader 
//    ClearImage COM Server 
 
using ClearImage; 
using ClearImageDLID; 
// ... 
 
static System.Threading.Mutex mut =  new System.Threading.Mutex();    // Prevents reentrancy 
private string Read_1D(string sFile) 
    { 
    try    { 
        mut.WaitOne(); 
             //  Create Reader 
        ClearImageDLID.Reader oReader = new  ClearImageDLID.Reader(); 
            //  Open image from file 
        oReader.Image.Open (sFile, 1); 
            //  Find barcodes 
        CiBarcode Bc = oReader.Read1D(); 
            // Process Results 
        if (Bc != null) return Bc.Text; 
        else            return ""; 
        } 
    catch (Exception ex) { 
        ShowError(ex); return "";} 
    finally    { 
        mut.ReleaseMutex(); 
        GC.Collect();} 
    }

See Also