如何设置UPC-E不扩展为GTIN-13 iOS
How to set UPC-E not to expand to GTIN-13 iOS
我正在使用 ZBar iOS sdk 来扫描条形码。扫描 UPC-E 代码后,它会将许多零加起来并带来 13 位代码。
当我查看 Zbar 的网站时,我发现了这个。
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.
但是,我找不到在哪里更改它。
有什么建议吗?
这样做解决了我的问题,
//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];
我正在使用 ZBar iOS sdk 来扫描条形码。扫描 UPC-E 代码后,它会将许多零加起来并带来 13 位代码。
当我查看 Zbar 的网站时,我发现了这个。
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.
但是,我找不到在哪里更改它。
有什么建议吗?
这样做解决了我的问题,
//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];