Resource Base
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

Decode Methods

Method Description
DecodeFile Decode barcodes from a specified image file.
DecodeFileInMemory Decode barcodes from an image file in memory.
DecodeBuffer Decode barcodes from raw buffer.
DecodeBase64String Decode barcodes from a base64 encoded string.
DecodeBitmap Decodes barcode from a bitmap.
InitIntermediateResult Inits an intermediateResult struct with default values.
DecodeIntermediateResults Decodes barcode from intermediate results.

DecodeFile

Decode barcodes from a specified image file.

TextResult[] Dynamsoft.DBR.BarcodeReader.DecodeFile(string fileName, string templateName) 	

Parameters
[in] fileName <string> : A string defining the file name. It supports BMP, JPEG, PNG, TIFF and PDF files.
[in] templateName <string> : The template name.

Return Value
All barcode text results decoded successfully.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
TextResult[] result = reader.DecodeFile(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Images\AllSupportedBarcodeTypes.tif", "");
reader.Dispose();

See Also
TextResult

DecodeFileInMemory

Decode barcodes from an image file in memory.

TextResult[] Dynamsoft.DBR.BarcodeReader.DecodeFileInMemory(byte[] fileStream, string templateName)  

Parameters
[in] fileStream <byte[]> : The image file bytes in memory.
[in] templateName <string> : The template name.

Return Value
All barcode text results decoded successfully.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
byte[] fileStream = GetFileStream(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Images\AllSupportedBarcodeTypes.tif");
TextResult[] result = reader.DecodeFileInMemory(fileStream, "");
reader.Dispose();

See Also
TextResult

DecodeBuffer

Decode barcodes from the memory buffer containing image pixels in defined format.

TextResult[] Dynamsoft.DBR.BarcodeReader.DecodeBuffer(byte[] buffer, int width, int height, int stride, EnumImagePixelFormat imagePixelFormat, string templateName)	

Parameters
[in] buffer <byte[]> : The array of bytes which contain the image data.
[in] width <int> : The width of the image in pixels. [in] height <int> : The height of the image in pixels. [in] stride <int> : The stride of the image (also called scan width).
[in] imagePixelFormat <EnumImagePixelFormat> : The image pixel format used in the image byte array. [in] templateName <string> : The template name.

Return Value
All barcode text results decoded successfully.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
Bitmap bBMP = new Bitmap(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Images\AllSupportedBarcodeTypes.tif");
BitmapData bmdat = bBMP.LockBits(new Rectangle(Point.Empty, bBMP.Size), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
int width = bBMP.Width;
int height = bBMP.Height;
int stride = bmdat.Stride;
byte[] buffer = new byte[stride * bmdat.Height];
Marshal.Copy(bmdat.Scan0, buffer, 0, buffer.Length);
bBMP.UnlockBits(bmdat);
EnumImagePixelFormat imagePixelFormat = EnumImagePixelFormat.IPF_ARGB_8888;
TextResult[] result = reader.DecodeBuffer(buffer, width, height, stride, imagePixelFormat, "");
reader.Dispose();

See Also
TextResult

DecodeBase64String

Decode barcode from an image file encoded as a base64 string.

TextResult[] Dynamsoft.DBR.BarcodeReader.DecodeBase64String(string base64, string templateName)	

Parameters
[in] base64 <string> : A base64 encoded string that represents an image.
[in] templateName <string> : The template name.

Return Value
All barcode text results decoded successfully.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
byte[] byteFileStream = GetFileStream(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Images\AllSupportedBarcodeTypes.tif");
string base64String = GetFileBase64String(byteFileStream);
TextResult[] result = reader.DecodeBase64String(base64String, "");
reader.Dispose();

See Also
TextResult

DecodeBitmap

Decodes barcode from a bitmap.

TextResult[] Dynamsoft.DBR.BarcodeReader.DecodeBitmap(Bitmap bitMap, string templateName)

Parameters
[in] bitMap <Bitmap> : The image to be decoded.
[in] templateName <string> : The template name.

Return Value
All barcode text results decoded successfully.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
Bitmap bBMP = new Bitmap(@"C:\Program Files (x86)\Dynamsoft\{Version number}\Images\AllSupportedBarcodeTypes.tif");
TextResult[] result = reader.DecodeBitmap(bBMP, "");
reader.Dispose();

See Also
TextResult

InitIntermediateResult

Inits an intermediateResult struct with default values.

IntermediateResult Dynamsoft.DBR.BarcodeReader.InitIntermediateResult(EnumIntermediateResultType intermediateResultType) 	

Parameters
intermediateResultType : The type of the intermediate result to init.

Return Value
An intermediateResult struct with default values.

Code Snippet

BarcodeReader reader = new BarcodeReader();
IntermediateResult imResult = reader.InitIntermediateResult(EnumIntermediateResultType.IRT_ORIGINAL_IMAGE);

See Also
IntermediateResult

DecodeIntermediateResults

Decodes barcode from intermediate results.

TextResult[] Dynamsoft.DBR.BarcodeReader.DecodeIntermediateResults(IntermediateResult[] intermediateResultArray, string templateName) 	

Parameters
intermediateResultArray : The intermediate result array for decoding.
templateName : The template name.

Return Value
All barcode text results decoded successfully.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
PublicRuntimeSettings settings = reader.GetRuntimeSettings();
settings.IntermediateResultType = (int)EnumIntermediateResultType.IRT_ORIGINAL_IMAGE;
reader.UpdateRuntimeSettings(settings);
reader.DecodeFile("Your file path", "");
IntermediateResult[] IMRs = reader.GetIntermediateResults();
TextResult[] result = reader.DecodeIntermediateResults(IMRs, "");

See Also
TextResult

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 8.6.0
  • Version 8.4.0
  • Version 8.2.5
  • Version 8.2.3
  • Version 8.2.1
  • Version 8.2.0
  • Version 8.1.3
  • Version 8.1.2
  • Version 8.1.0
  • Version 8.0.0
  • Version 7.6.0
  • Version 7.5.0
Change +
© 2003–2021 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support