GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / Barcode1DReaderDoScan Method / Barcode1DReaderDoScan(Int32,Barcode1DReaderScanMode,Barcode1DReaderType,Boolean,Int32) Method
A unique image identifier of the GdPicture image representing the image in use.
A member of the Barcode1DReaderScanMode enumeration. The scan mode (speed or quality) used for scanning process.
A member or a combination of members of the Barcode1DReaderType enumeration.
Example





In This Topic
Barcode1DReaderDoScan(Int32,Barcode1DReaderScanMode,Barcode1DReaderType,Boolean,Int32) Method
In This Topic
Starts a barcode recognition process on a specified GdPicture image or on an area of a specified GdPicture image defined by the GdPictureImaging.SetROI method. This method allows you to set the scanning mode parameter according to your preference as well as to specify the type of barcodes to be searched for.
Syntax
'Declaration
 
Public Overloads Function Barcode1DReaderDoScan( _
   ByVal ImageID As Integer, _
   ByVal ScanMode As Barcode1DReaderScanMode, _
   ByVal BarcodeType As Barcode1DReaderType, _
   ByVal ReturnCorrupted As Boolean, _
   ByVal ExpectedCount As Integer _
) As GdPictureStatus
public function Barcode1DReaderDoScan( 
    ImageID: Integer;
    ScanMode: Barcode1DReaderScanMode;
    BarcodeType: Barcode1DReaderType;
    ReturnCorrupted: Boolean;
    ExpectedCount: Integer
): GdPictureStatus; 
public function Barcode1DReaderDoScan( 
   ImageID : int,
   ScanMode : Barcode1DReaderScanMode,
   BarcodeType : Barcode1DReaderType,
   ReturnCorrupted : boolean,
   ExpectedCount : int
) : GdPictureStatus;

Parameters

ImageID
A unique image identifier of the GdPicture image representing the image in use.
ScanMode
A member of the Barcode1DReaderScanMode enumeration. The scan mode (speed or quality) used for scanning process.
BarcodeType
A member or a combination of members of the Barcode1DReaderType enumeration.
ReturnCorrupted
ExpectedCount

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
Remarks
This method will try to detect all available barcodes. You can use the GdPictureImaging.Barcode1DReaderDoScan method and set the ExpectedCount parameter to 1 and StopOnExpectedCount to true, to stop the recognition process after the first barcode was found.

For more details, please refer to our Barcode Recognition Sample included in the installation folder that demonstrates the usage of this method.

Example
Finding all 1D barcodes in a given image and saving their information to a file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg", false);
 
    // Start the barcode scanning process to find all available 1D barcode symbols using the best speed.
    gdpictureImaging.Barcode1DReaderDoScan(imageID, Barcode1DReaderScanMode.BestSpeed);
 
    using (System.IO.StreamWriter file = new System.IO.StreamWriter("barcodes.txt"))
    {
        int barcodesFound = gdpictureImaging.Barcode1DReaderGetBarcodeCount();
        for (int i = 1; i <= barcodesFound; i++)
        {
            file.WriteLine(gdpictureImaging.Barcode1DReaderGetBarcodeValue(i));
        }
    }
 
    // Release used resources.
    gdpictureImaging.Barcode1DReaderClear();
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also