DecodeFileRect Method

Description

Decodes the area specified by the parameters top, left, width, height on a local image and finds the barcodes.

Syntax

Public Sub DecodeFileRect( _
    ByVal strFileName As String, _
    ByVal rectLeft As Long, _
    ByVal rectTop As Long , _
    ByVal rectWidth As Long , _
    ByVal rectHeight As Long _ 
)

Parameters

strFileName
The path of the file.
rectLeft, rectTop, rectWidth, rectHeight
The coordinates used to specify an area for barcode reading.

Remarks

The file to read needs to be an image in the formats BMP, JPG, PNG, TIFF or PDF.

If your barcodes are from PDF files, DynamicPdf.dll and DynamicPdfx64.dll are mandatory.

Example

Dim reader As New DBRCtrl.BarcodeReader
Dim rdOption As New DBRCtrl.ReaderOptions
Dim oBarcodeFormat As New BarcodeFormat
rdOption.MaxBarcodesNumPerPage = 1
rdOption.BarcodeFormats = _
        oBarcodeFormat.OneD  Or _ 
        oBarcodeFormat.QR_CODE Or _
        oBarcodeFormat.PDF417 Or _
        oBarcodeFormat.DATAMATRIX
Set reader.ReaderOptions = rdOption
reader.DecodeFileRect "c:\test.bmp" 0 0 100 100
Dim iCount As Integer
Dim oBarcodes As BarcodeResultArray
Set oBarcodes = reader.Barcodes
iCount = oBarcodes.Count
For i = 0 To iCount - 1
   Dim bc As BarcodeResult
   Set bc = oBarcodes.Item(i)
   MsgBox bc.BarcodeText
Next i
Set reader = Nothing
Set rdOption = Nothing
Set oBarcodeFormat = Nothing

See Also

ActiveX/COM > Objects > BarcodeReader > DecodeFileRect
ActiveX/COM > Objects > BarcodeReader > ErrorCode
ActiveX/COM > Objects > ReaderOptions > BarcodeFormats
ActiveX/COM > Objects > ReaderOptions > MaxBarcodesNumPerPage
ActiveX/COM > Objects > BarcodeResult
ActiveX/COM > Objects > BarcodeResultArray