-
Notifications
You must be signed in to change notification settings - Fork 62
code 128 generation #5
Comments
Can you try generating the barcode as a PDF and drawing it to the screen in your drawRect with CGContextDrawPDFPage? I ask because I had better success with barcode scanning when generating the barcode as a PDF and drawing it to the screen than I did using a UIImage generated from the CGContext draw calls. I didn't get around to investigating the "why's" closely enough to give you an absolute reason why this works, but my theory at the time of working w/ it was that there was some aliasing occurring in the UIImage draw that wasn't happening when I drew a CGPDFDocumentRef to the screen. Sorry can't be more exact, but hope that helps. |
Thanks for the quick answer and the tips !!! In fact here is the code 128 that I generate with cocoa touch http://dl.dropbox.com/u/3037130/ios%20generated%20code%20128a.png And there is another one generated on some website : The begining is the same but between the middle and the last 3 bar there is some differences.. |
Note CocoaTouchBarcodes is not my library. It is simply a library that we If you need changes on github feel free to fork it. I and Chris Z. (aka For support and thanking people go to On Thu, Aug 25, 2011 at 9:10 AM, bcharp <
Dale King |
bcharp: Weird. The code 128 algorithm has always been a bit flaky, both dale and I had to make some bugfixes to it. If you have time to take a look at it, it'd be appreciated; otherwise, when I can get to it, I'll try, but I'm not actively maintaining this atm. |
Ok guys, thanks anyway. |
Hi! I am doing a project which can auto generated a barcode through my iphone application.
#import "UIImage-NKDBarcode.h" -(void)showBarcode { But it did not work. Did i miss anything or did something wrong? Thanks&Regards! |
Hello, is someone find a way to generate barcode 128 ? Thank you |
I have a generated 128-bit barcode which the last 3 bar is cut off. The barcode number is 0395400000000236. I checked by using few barcode generator on website and problem is defined. |
Hi, I don't know what I experienced is helpful, but some barcode generated by this library cannot be read by some reader. And I think we must specify bar width ( but I don't read code carefully enough ). I added new constructor and if you specify imageWidth, it calculate appropriate barWidth. https://github.com/pandora2000/Cocoa-Touch-Barcodes |
Hi, you should call the generateChecksum method for recalculating the checkDigit. NKDCode128Barcode *barcode = [NKDCode128Barcode alloc]; |
I had issues with this until I figured out that to match my requirements, I needed to generate the barcode without a checksum, then add the checksum explicitly. Not having a checksum will trim a few lines off your barcode, which might be what felixwcf and pandora2000 were seeing. Taking yann86's tip (thanks!), this worked for me:
The value of -1 for andCheckDigit on the first line means "no check digit". Then I add the check digit in the third line. Good luck! |
Hi,
I'm trying to generate code 128 A or B barcode with 7 digit like 3144798 (not a code 128C because I need to have 7 digit not 8) and I'm becoming a bit crazy, it seems that the generated barcode isn't right...
It ALMOST look like a barcode I can generate somewhere like here : http://generator.onbarcode.com/online-code-128-barcode-generator.aspx
But when I look closely some bars aren't right and my linea pro won't scan the barcode(after printing not on the screen).
Here is the code I use to generate the barcode, maybe I'm doing something wrong.
NKDCode128Barcode *barcode = [NKDCode128Barcode alloc];
barcode = [barcode initWithContent:@"3144798" printsCaption:NO];
[barcode setBarWidth:1.0];
[barcode setCodeSet:SET_B];
NSLog(@"%@",[barcode description]);
UIImage *theImage = [UIImage imageFromBarcode:barcode inRect:CGRectMake(0.0, 0.0, 300, 100.0)];
UIImageView *imageView = [[UIImageView alloc] initWithImage:theImage];
imageView.contentMode = UIViewContentModeCenter;
imageView.frame = CGRectMake(10.0, 100.0, 300, 100);
[self.view addSubview:imageView];
I switched on code 39 for the time being, it seems to works great, but code 128 would be better...
In any case thank you all for the amazing works.
The text was updated successfully, but these errors were encountered: