Dev Center
Table of contents

.Net API Reference - BarcodeReader 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.

DecodeFile

Decode barcodes from a specified image file.

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

Parameters

[in] fileName <string> : A string defining the file name.
[in] templateName <string> : The template name.

Return value

All barcode text results decoded successfully.

Exceptions

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.Barcode.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.

Exceptions

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.Barcode.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.

Exceptions

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.Barcode.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.

Exceptions

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.Barcode.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.

Exceptions

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

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

version 7.6.0

  • Latest version
  • Version 10.x
    • Version 10.2.0
    • Version 10.0.20
    • Version 10.0.10
    • Version 10.0.0
  • Version 9.x
    • Version 9.6.40
    • Version 9.6.30
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.0
    • Version 9.0.0
  • Version 8.x
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +