How to set UPC-E not to expand to GTIN-13 iOS

158 views Asked by At

I am using ZBar iOS sdk to scan barcodes. Upon scanning UPC-E codes it adds up lots of zeros and brings 13 digit codes.

When I check with Zbar's website, I came across this.

UPC-E is a “zero compressed” version of UPC-A; certain of the zeros are removed from the UPC-A data to generate the UPC-E barcode. The ZBar decoder expands this compression by default, again to consistently report GTIN-13 product codes. You can choose to receive the compressed 8-digit results instead by explicitly enabling UPC-E.

However, I couldn't find where to change this.

Any suggestions?

1

There are 1 answers

0
Vic85 On BEST ANSWER

Doing this solved my issue,

//ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;


ZBarImageScanner *scanner = reader.scanner;

// Set zbar_cfg_enable to 1 for UPC-E
[scanner setSymbology: ZBAR_UPCE
               config: ZBAR_CFG_ENABLE
                   to: 1];