Search code examples
zbar-sdk

iOS ZBar: Getting only the encoded data (not check digits, etc.)


Say a Code128 barcode image has an exact string representation of 001234567890000 when scanned. Assume the leading and trailing 0s are actually check digits, etc. The actual code is then just 123456789.

If I use Zbar to decode the image, I get the same string (i.e. 001234567890000). How can I get ZBar to return me just the actual encoded data (i.e. 123456789). The below does not seem to be helping.

scanner.setSymbology(ZBAR_CODE128, config: ZBAR_CFG_ADD_CHECK, to: 1) // Or even 0 for that matter
scanner.scanImage(zBarImage)

Although if I understand correctly, ZBAR_CFG_ADD_CHECK will actually just perform the check digit validation and if it fails will not even give me the decoded string representation.


Solution

  • Ok, this page helps. emit-check is the right key and needs to be set to 0. https://www.mankier.com/1/zbarimg