Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, July 12, 2019 11:23:07 AM(UTC)
Joe Kerrigan

Groups: Registered, Tech Support
Posts: 6


When using BarcodeReader to read barcodes of only one symbology, developers can specify options easily by calling BarcodeReader.ReadBarcode(RasterImage, LeadRect, BarcodeSymbology, BarcodeReadOptions) and providing the options for that specific symbology.

If you are targeting many symbologies at once, it is not as clear how to specify custom options for some symbologies while leaving the default options in place for others. Luckily, BarcodeReader.ReadBarcode() will accept an array of symbologies and their corresponding options. By providing only the BarcodeReadOptions you wish to override the defaults, you can ensure that other symbologies will use their default options if your overrides do not apply.

In the following snippet, an array of BarcodeReadOptions is created to contain the options that override the default settings. Using BarcodeReader.GetDefaultOptions(BarcodeSymbology), you could modify the options for any barcode symbology supported by the LEADTOOLS Barcode toolkit. In this instance, the developer has opted to change barcode options for QR codes and one-dimensional barcodes such as EAN-13.

Code:

OneDBarcodeReadOptions onedOpts = barcodeEngine.Reader.GetDefaultOptions(BarcodeSymbology.EAN13) as OneDBarcodeReadOptions;
onedOpts.ReturnCheckDigit = BarcodeReturnCheckDigit.No;

QRBarcodeReadOptions qrOpts = barcodeEngine.Reader.GetDefaultOptions(BarcodeSymbology.QR) as QRBarcodeReadOptions;
qrOpts.EnablePreprocessing = true;
qrOpts.EnableDoublePass = true;

BarcodeReadOptions[] readOptions = new BarcodeReadOptions[] { onedOpts, qrOpts };


Later, when reading barcodes, simply supply your array of BarcodeReadOptions as an argument to ReadBarcode:
Code:

BarcodeData data = barcodeEngine.Reader.ReadBarcode(image, LeadRect.Empty, null, readOptions);

If you want to restrict the symbologies processed by this BarcodeReader, pass in an array of barcode symbologies as the third argument to ReadBarcode. In this case, the array is null, signifying that this BarcodeReader should process all symbologies. If the developer had passed in an array containing BarcodeSymbology.EAN13 and BarcodeSymbology.QR, the BarcodeReader would only recognize EAN-13 barcodes and QR codes.

Since the developer has only provided options for one-dimensional barcodes and QR codes, other types of barcodes will be read using their default options. Overriding options for other symbologies is as easy as acquiring the default options using BarcodeReader.GetDefaultOptions(BarcodeSymbology), changing the options to your liking, and adding them to the readOptions array.
Joe Kerrigan
Intern
LEAD Technologies, Inc.
leadtools header
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.054 seconds.