我正在制作一个免费的条形码阅读器应用程序。 我正在寻找免费的 SDK 来解码 Datamatrix、QR、Aztec、UPC、EAN 条形码。 我现在已经实现了 ZBar SDK。成功检测QR、UPC和EAN。 我测试过This link
但是这些都无法正确检测 Aztec。 通过 Data Matrix、UPC、EAN 和 QR,我发现 Redlaser 非常有效,但现在它不是免费的。
现在,是否有任何免费的 SDK 可用于检测所有四个条形码而无需付费,因为我想让我的应用程序在应用程序商店中免费。
请提出建议
P.S 我希望扫描仪与最新的 iOS 兼容。
最佳答案
通过一些工作,您可以使用 zint 来完成此操作。请参阅https://github.com/samlown/zint/blob/master/backend/aztec.c 我在一个应用程序中使用过这个。抱歉,我不能分享比这更多的代码: 包括条形码、aztec、common、font、gs1、rs 和 bmp 类 然后将下面的代码放在一个单独的类中
void dataProviderReleased (void *info, const void *data, size_t size) {
struct barcode_symbol *my_symbol = info;
Barcode_Delete(my_symbol);
}
+ (UIImage *)aztecBarcodeImageFromString:(NSString *)s scale:(CGFloat)scale {
UIImage *image = nil;
int errorCode = 0;
struct barcode_symbol *my_symbol;
if (s == nil) {
return nil;
}
unsigned char *unicodeCharPtr = (unsigned char *)[s cStringUsingEncoding:NSUTF8StringEncoding];
LogInfo(@"Creating barcode image for string: %@", s);
my_symbol = Barcode_Create();
my_symbol->output_options = 0;
//my_symbol->output_options = BARCODE_BOX; //For a box around the bar code
my_symbol->scale = scale;
my_symbol->symbology = BARCODE_AZTEC;
my_symbol->input_mode = UNICODE_MODE;
errorCode = Barcode_Encode(my_symbol, unicodeCharPtr, 0);
if (errorCode == 0) {
errorCode = Barcode_Buffer(my_symbol, 0);
if (errorCode == 0) {
int numberOfComponents = 3;
long imgSizePerRow = numberOfComponents * my_symbol->bitmap_width;
long imgSize = imgSizePerRow * my_symbol->bitmap_height;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
//The dataProviderReleased method is responsible for deallocating the ZBarCode with the corresponding image data
CGDataProviderRef providerRef = CGDataProviderCreateWithData(my_symbol, my_symbol->bitmap, imgSize, dataProviderReleased);
CGImageRef imageRef = CGImageCreate(my_symbol->bitmap_width, my_symbol->bitmap_height, 8, numberOfComponents * 8,
imgSizePerRow, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaNone,
providerRef, NULL, NO, kCGRenderingIntentDefault);
image = [UIImage imageWithCGImage:imageRef];
CGColorSpaceRelease(colorSpace);
CGDataProviderRelease(providerRef);
CGImageRelease(imageRef);
} else {
LogWarn(@"Could not buffer barcode, error=%d", errorCode);
Barcode_Delete(my_symbol);
}
} else {
LogWarn(@"Could not encode barcode, error=%d", errorCode);
Barcode_Delete(my_symbol);
}
return image;
}
关于ios - iOS 中各种条码阅读器免费 SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15779477/