Reputation: 7804
I am using Zbar for my iOS barcode scanning app but the problem is it is not detecting pdf-417 type of barcodes. I've installed ZBAR app for iPhone it is also unable to detect pdf417. But in zbar symbols structure pdf 417 is added. I also tried to enable pdf-417 explicitly by this line of code, but no luck.
[scanner setSymbology: ZBAR_PDF417 config: ZBAR_CFG_ENABLE to: 1];
Any help?
Upvotes: 4
Views: 3894
Reputation: 4614
Zbar scanner support only some specific bar code types.
It supports bar code formats such us AN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR Code.
Refer to this site: http://zbar.sourceforge.net/
For PDF-417 bar code some separate SDK is available it seems. It will support the bar code such us Pdf417, QrCode, LicenseInfo, Code128, Code39, EAN13, EAN8, ITF, UPC and UPCE.
https://github.com/PDF417/pdf417-ios
Customize this one with the config type:
[scanner setSymbology: ZBAR_PDF417 config: ZBAR_CFG_ENABLE to: 1];
Just try with all the config type and check.
typedef enum zbar_config_e {
ZBAR_CFG_ENABLE = 0, /**< enable symbology/feature */
ZBAR_CFG_ADD_CHECK, /**< enable check digit when optional */
ZBAR_CFG_EMIT_CHECK, /**< return check digit when present */
ZBAR_CFG_ASCII, /**< enable full ASCII character set */
ZBAR_CFG_NUM, /**< number of boolean decoder configs */
ZBAR_CFG_MIN_LEN = 0x20, /**< minimum data length for valid decode */
ZBAR_CFG_MAX_LEN, /**< maximum data length for valid decode */
ZBAR_CFG_UNCERTAINTY = 0x40,/**< required video consistency frames */
ZBAR_CFG_POSITION = 0x80, /**< enable scanner to collect position data */
ZBAR_CFG_X_DENSITY = 0x100, /**< image scanner vertical scan density */
ZBAR_CFG_Y_DENSITY, /**< image scanner horizontal scan density */
} zbar_config_t;
Upvotes: 4
Reputation: 1989
If you are using iOS7 or above, you don't have to rely on third-party libraries like ZBar. AVFoundation has built-in support for detecting 1D and 2D barcodes including PDF417 and QR codes using the device camera. AVMetadataMachineReadableCodeObject does the trick.
You can find working examples here and here.
Upvotes: 2