DecodeFile Method

Decodes barcodes in the specified image file.

Syntax

int DecodeFile(const char* pFileName);

Parameters

pFileName
A string defining the file name.

Return Value

Zero if the function completed successfully; otherwise nonzero.

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

CBarcodeReader reader;

int iErrorCode = reader.InitLicense("88FFAA09C42D5DE******");

ReaderOptions options;
options.iMaxBarcodeNumPerPage = 1;
options.llBarcodeFormats = (OneD | QR_CODE | PDF417 | DATAMATRIX);

reader.SetReaderOptions(options);
iErrorCode = reader.DecodeFile("C:\\test.bmp");
if(iErrorCode != DBR_OK)
	return;

pBarcodeResultArray pResults = NULL;
reader.GetBarcodes(&pResults);
int iCount = pResults->iBarcodeCount;
for(int i = 0; i < iCount; ++i)
{
	printf("%d: %s\n", i, pResults->ppBarcodes[i]->pBarcodeData);
}

See Also

C++ > Structs > ReaderOptions
C++ > Structs > BarcodeResultArray
C++ > Class > CBarcodeReader > DecodeFileRect
C++ > Constant > BarcodeFormat
C++ > Constant > Error List