Kofax Mobile SDK API Reference
Classes | Public Member Functions | List of all members
BarCodeReader Class Reference

The barcode recognition engine. More...

Classes

class  BarcodeReadCompleteEvent
 
interface  BarcodeReadCompleteListener
 
enum  Direction
 
enum  Symbology
 

Public Member Functions

 BarCodeReader ()
 Default constructor. Sets everything to default values: MaxBarcodes to 1, SearchSymbology, and SearchDirection are set to All. More...
 
 BarCodeReader (Symbology[] symbology, Direction direction, int maxBarcode)
 Constructor to use when initial barcode engine setup values are specified. More...
 
String getBcVersion ()
 Method to acquire the version of the barcode library. More...
 
void readBarcodes (Image image) throws KmcException
 Scans the image using the settings specified, and appends the barcode results to the image. More...
 
int getMaxBarcodes ()
 Gets the maximum number of barcode results to search for. More...
 
void setMaxBarcodes (int maxBarcodes)
 Sets the maximum number of barcode results to search for. More...
 
Symbology[] getSearchSymbology ()
 Gets the set of symbologies to be searched for. More...
 
void setSearchSymbology (Symbology[] symbologies)
 Sets the set of symbologies to be searched for. More...
 
Direction getSearchDirections ()
 Gets the set of directions to be searched for barcodes. More...
 
void setSearchDirections (Direction searchDirections)
 Sets the set of directions to be searched for barcodes. More...
 
void addBarcodeReadCompleteEventListener (BarcodeReadCompleteListener listener)
 Adds the specified BarcodeReadCompleteListener to receive read complete events from the BarCodeReader. More...
 
void removeBarcodeReadCompleteEventListener (BarcodeReadCompleteListener listener)
 Removes the specified barcode read complete event listener from the BarCodeReader. More...
 

Detailed Description

The barcode recognition engine.

Create an instance of this class to perform barcode recognition on a standalone image. The engine can be configured to search for a specific subset of barcode symbologies, barcodes oriented in particular directions, and a maximum number of barcodes to return. For best performance, each of these criteria should be restricted as much as possible.

Any barcode results found will be populated in a property on the input Image object, and the engine will fire an event through a registered listener when recognition is completed or fails.

Constructor & Destructor Documentation

Default constructor. Sets everything to default values: MaxBarcodes to 1, SearchSymbology, and SearchDirection are set to All.

The default constructor, sets the max barcodes to be found at 1, the symbology array to an empty array, and search direction to 'All'.

BarCodeReader ( Symbology[]  symbology,
Direction  direction,
int  maxBarcode 
)

Constructor to use when initial barcode engine setup values are specified.

The BarCodeReader constructor. If null is passed in for any of the parameters they will be set to their respective default value.

Parameters
symbologyPass in an array of Symbology to have the barcode reader engine look for.
directionPass in a Direction that the barcode reader engine will search for barcodes in.
maxBarcodeThe maximum number of barcodes that will be searched for.

Member Function Documentation

void addBarcodeReadCompleteEventListener ( BarcodeReadCompleteListener  listener)

Adds the specified BarcodeReadCompleteListener to receive read complete events from the BarCodeReader.

Adds a barcode reader complete event listener.

Parameters
listenerAn instance of a BarcodeReadCompleteListener.
String getBcVersion ( )

Method to acquire the version of the barcode library.

This method calls the barcode library and requests the build version number.

int getMaxBarcodes ( )

Gets the maximum number of barcode results to search for.

Returns
The maximum number of barcodes that will be searched for.
Direction getSearchDirections ( )

Gets the set of directions to be searched for barcodes.

Returns
The Direction value that is currently set.
See also
Direction
Symbology [] getSearchSymbology ( )

Gets the set of symbologies to be searched for.

Returns
An array of Symbology values.
See also
Symbology
void readBarcodes ( Image  image) throws KmcException

Scans the image using the settings specified, and appends the barcode results to the image.

Pass in an Image to have the barcode reader search for barcodes.

This method is asynchronous, and will return when the recognition process is started. Results and status will be returned to any registered listeners. Any located barcodes will be automatically populated into the Image object that was initially supplied to this method.

The supplied Image can be in either the file or bitmap representation. 1 bit-per-pixel images are not supported.

This feature requires a valid SDK license. For feature-based SDK licenses, the Barcode Capture feature must be enabled.

Parameters
imageThe image to search for barcodes.
void removeBarcodeReadCompleteEventListener ( BarcodeReadCompleteListener  listener)

Removes the specified barcode read complete event listener from the BarCodeReader.

Removes a barcode reader complete event listener.

Parameters
listenerAn instance of a BarcodeReadCompleteListener.
void setMaxBarcodes ( int  maxBarcodes)

Sets the maximum number of barcode results to search for.

Set this value to the maximum number of barcodes you expect to find in the target image.

Searching for more barcodes than exist in a document will cause the reader to fully exhaust its search space, resulting in slower recognition times.

Parameters
maxBarcodesThe maximum number of barcodes to search for.
void setSearchDirections ( Direction  searchDirections)

Sets the set of directions to be searched for barcodes.

Searching multiple directions slows down the speed of barcode recognition. If you expect barcodes to only be oriented in certain directions, you should specify only those directions. By default, all directions will be searched.

It is an error to search for barcodes with no directions selected.

Parameters
searchDirectionsA Direction value.
See also
Direction for all supported values.
void setSearchSymbology ( Symbology[]  symbologies)

Sets the set of symbologies to be searched for.

Each symbology represents a class of barcodes, like UPC or PDF417. A class may match multiple subtypes, such as UPC-A and UPC-E within the UPC symbology.

Searching for multiple symbologies slows down the speed of barcode recognition. You should only specify the symbologies that you are interested in reading. The set of selected symbologies is empty by default.

It is an error to search for barcodes with no symbologies selected.

Parameters
symbologiesAn array of one or more Symbology values.
barcodeReader.setSymbologies(new Symbology[] { Symbology.Code39, Symbology.Pdf417 });
See also
Symbology for all supported values.

The documentation for this class was generated from the following file:
Untitled Document © 2018 Kofax, Inc. All rights reserved. Use is subject to license terms.