Dev Center
Swift
Objective-C
Table of contents

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.
decodeBufferedImage Decodes barcode from a buffered imag (bitmap).

decodeFile

Decode barcodes from a specified image file.

TextResult[] decodeFile(String fileFullPath, String templateName) throws BarcodeReaderException

Parameters

fileFullPath: A string defining the file path.
templateName: The template name.

Return Value

All barcode text results decoded successfully.

Exceptions

BarcodeReaderException

Code Snippet

BarcodeReader reader = new BarcodeReader();
/*Init DBR license before decoding*/
TextResult[] result = reader.decodeFile("your file path", "");

decodeFileInMemory

Decode barcodes from an image file in memory.

fileBytes

TextResult[] decodeFileInMemory(byte[] fileBytes, String templateName) throws BarcodeReaderException

Parameters

fileBytes: The image file bytes in memory.
templateName: The template name.

Return Value

All barcode text results decoded successfully.

Exceptions

BarcodeReaderException

Code Snippet

BarcodeReader reader = new BarcodeReader();
/*Init DBR license before decoding
get bufferBytes from other component*/
TextResult[] result = reader.decodeFileInMemory(bufferBytes, "");

fileStream

TextResult [] decodeFileInMemory(InputStream fileStream, String templateName) throws BarcodeReaderException, IOException

Parameters

fileStream: The image file bytes in memory.
templateName: The template name.

Return Value

All barcode text results decoded successfully.

Exceptions

BarcodeReaderException, IOException

Code Snippet

BarcodeReader reader = new BarcodeReader();
/*Init DBR license before decoding
get bufferBytes from other component*/
TextResult[] result = reader.decodeFileInMemory(fis, "");

decodeBuffer

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

TextResult[] decodeBuffer(byte[] buffer, int width, int height, int stride, int enumImagePixelFormat, String templateName) throws BarcodeReaderException

Parameters

buffer: The array of bytes which contain the image data.
Width: The width of the image in pixels.
Height: The height of the image in pixels.
Stride: The stride (or scan width) of the image.
format: The image pixel format used in the image byte array.
templateName: The template name.

Return Value

All barcode text results decoded successfully.

Exceptions

BarcodeReaderException

Code Snippet

BarcodeReader reader = new BarcodeReader();
/*Init DBR license before decoding*/
byte[] bufferBytes;
int iWidth = 0;
int iHeight = 0;
int iStride = 0;
int format;
GetBufferFromFile("your file path", bufferBytes, iWidth, iHeight, iStride, format);
TextResult[] result = reader.decodeBuffer(bufferBytes, iWidth,  iHeight, iStride, format, "");

decodeBase64String

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

TextResult[] decodeBase64String(String base64, String templateName) throws BarcodeReaderException

Parameters

base64: A base64 encoded string that represents an image.
templateName: The template name.

Return Value

All barcode text results decoded successfully.

Exceptions

BarcodeReaderException

Code Snippet

BarcodeReader reader = new BarcodeReader();
/*Init DBR license before decoding*/
TextResult[] result = reader.decodeBase64String("file in base64 string", "");

decodeBufferedImage

Decodes barcode from a buffered image (bitmap).

TextResult[] decodeBufferedImage(Bitmap image, String templateName) throws IOException, BarcodeReaderException

Parameters

image: The image to be decoded.
templateName: The template name.

Return Value

All barcode text results decoded successfully.

Exceptions

BarcodeReaderException, IOException

Code Snippet

BarcodeReader reader = new BarcodeReader();
/*Init DBR license before decoding*/
/*get BufferedImage input from other component*/
TextResult[] result = reader.decodeBufferedImage(input, "");

initIntermediateResult

Inits an intermediateResult struct with default values.

IntermediateResult initIntermediateResults(int resultType) throws BarcodeReaderException

Parameters

resultType: The type of the intermediate result to init.

Return Value

An intermediateResult struct with default values.

Exceptions

BarcodeReaderException

Code Snippet

BarcodeReader reader = new BarcodeReader();
/*Init DBR license before decoding*/
IntermediateResult imResult = reader.initIntermediateResult(EnumIntermediateResultType.IRT_ORIGINAL_IMAGE);

decodeIntermediateResults

Decodes barcode from intermediate results.

TextResult[] decodeIntermediateResults(IntermediateResult[] results, String templateName) throws BarcodeReaderException

Parameters

results: An array of intermediate result.
templateName: The template name.

Return Value

All barcode text results decoded successfully.

Exceptions

BarcodeReaderException

Code Snippet

BarcodeReader reader = new BarcodeReader();
/*Init DBR license before decoding*/
PublicRuntimeSettings settings = reader.getRuntimeSettings();
settings.intermediateResultTypes = EnumIntermediateResultType.IRT_ORIGINAL_IMAGE;
reader.updateRuntimeSettings(settings);
reader.decodeFile("your file path", "");
IntermediateResult[] irtResult = reader.getIntermediateResults();
TextResult[] result = reader.decodeIntermediateResults(irtResult, "");

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

version 8.6.0

  • Latest version (10.2.10)
  • Version 10.x
    • Version 10.0.21
    • Version 10.0.20
  • Version 9.x
    • Version 9.6.20
    • Version 9.6.11
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.13
    • Version 9.2.11
    • Version 9.2.10
    • Version 9.0.2
    • Version 9.0.1
    • Version 9.0.0
  • Version 8.x
    • Version 8.9.3
    • Version 8.9.1
    • Version 8.9.0
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.1
    • 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 +