Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fork of Jeff Lamarche's original barcode generator library at http://code.google.com/p/cocoabarcodes/

branch: master

add link back to original

latest commit 7d96a060d0
Chris authored
Octocat-spinner-32 CocoaTouchBarcodes.xcodeproj Change project to specify latest ios version for all configurations March 28, 2011
Octocat-spinner-32 .gitignore Add XCode4 directories to .gitignore March 25, 2011
Octocat-spinner-32 CocoaTouchBarcodes_Prefix.pch initial commit April 21, 2010
Octocat-spinner-32 JapanPostBarcode.h initial commit April 21, 2010
Octocat-spinner-32 JapanPostBarcode.m Whoops February 06, 2012
Octocat-spinner-32 NKDAbstractUPCEANBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDAbstractUPCEANBarcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NKDBarcode.h increase dpi to reflect iphone April 22, 2010
Octocat-spinner-32 NKDBarcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NKDBarcodeFramework.h fix old header ref April 26, 2010
Octocat-spinner-32 NKDBarcodeOffscreenView.h refactor drawing method, add pdf rendering method April 22, 2010
Octocat-spinner-32 NKDBarcodeOffscreenView.m fix memory leak July 09, 2010
Octocat-spinner-32 NKDCodabarBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDCodabarBarcode.m initial commit April 21, 2010
Octocat-spinner-32 NKDCode128Barcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDCode128Barcode.m Update NKDCode128Barcode.m January 09, 2013
Octocat-spinner-32 NKDCode39Barcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDCode39Barcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NKDEAN13Barcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDEAN13Barcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NKDEAN8Barcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDEAN8Barcode.m Add XCode4 directories to .gitignore March 25, 2011
Octocat-spinner-32 NKDExtendedCode39Barcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDExtendedCode39Barcode.m initial commit April 21, 2010
Octocat-spinner-32 NKDIndustrialTwoOfFiveBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDIndustrialTwoOfFiveBarcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NKDInterleavedTwoOfFiveBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDInterleavedTwoOfFiveBarcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NKDModifiedPlesseyBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDModifiedPlesseyBarcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NKDModifiedPlesseyHexBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDModifiedPlesseyHexBarcode.m initial commit April 21, 2010
Octocat-spinner-32 NKDPlanetBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDPlanetBarcode.m initial commit April 21, 2010
Octocat-spinner-32 NKDPostnetBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDPostnetBarcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NKDRoyalMailBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDRoyalMailBarcode.m initial commit April 21, 2010
Octocat-spinner-32 NKDUPCABarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDUPCABarcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NKDUPCEBarcode.h initial commit April 21, 2010
Octocat-spinner-32 NKDUPCEBarcode.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 NSString-UPCEAN.h initial commit April 21, 2010
Octocat-spinner-32 NSString-UPCEAN.m FIXED › Compatibility with iOS4 (replaced deprecated methods) March 18, 2011
Octocat-spinner-32 README.md add link back to original January 13, 2013
Octocat-spinner-32 UIImage-NKDBarcode.h add pdf data generating helper method (TODO: move to more logical place) April 22, 2010
Octocat-spinner-32 UIImage-NKDBarcode.m add pdf data generating helper method (TODO: move to more logical place) April 22, 2010
Octocat-spinner-32 UIImage-Normalize.h initial commit April 21, 2010
Octocat-spinner-32 UIImage-Normalize.m initial commit April 21, 2010
README.md

This is a fork of Jeff Lamarche's Cocoa Barcodes project, with the code modified to work on the iPhone and iPad. In my testing, a CCD and laser scanner can read UPC and Code 128 barcodes directly from the screen w/ no issue. I haven't tested other barcodes yet.

Usage: You can add the project as a dependency to your existing project and add a target dependency on the static library target. Alternatively you can add the source code bulk to your own project.

If you use the static library dependency, you'll want to ensure that you are compiling your own project with the -ObjC "Other Linker Flag" in your project settings.

To use the library, you'll want to include the relevant header file for the barcode you want to generate, as well as the UIImage category for generating the image.

#import "NKDUPCEBarcode.h"
#import "UIImage-NKDBarcode.h"

// etc...

NKDUPCEBarcode * code = [[NKDUPCEBarcode alloc] initWithContent:@"Your Barcode Contents"];
NSData * generatedPdf = [UIImage pdfFromBarcode:code]; // Generate the barcode as a PDF
UIImage * generatedImage = [UIImage imageFromBarcode:code]; // ..or as a less accurate UIImage

TODO:

  • Add tests. (!!!!!!!!!!!)
  • Better documentation
  • Really, the entire API pretty much needs a refactor. The UIImage category as entry point into generating images as a start, NKDBarcodeOffscreenView doesn't really need to subclass UIView, etc..
  • Leak checks
  • ARC compatibility? I guess?

Things that are missing:

  • Rendering the actual numbers of a code below the barcode
  • rectForPage, knowsPageRange don't have any affect on the barcode rendering now

Things that have changed:

  • the UIImage for the barcode is generated on the calling thread, as opposed to the library's old behavior of generating the image on a separate thread
  • the library provides UIImage and PDF generation of barcodes - PDF is more accurate

Things that misbehave:

  • The Code128 generation works for many common cases, but we need a test suite to verify behavior

Things that have been fixed:

Current status:

  • I'm very inactive with maintenance. I'm not currently maintaining the code, nor do I have a plan to get to any of the major checklist items anytime soon. If you're interested in taking a more active role in development, contact me and I'll do what I can to help you out.

Other contributors:

Something went wrong with that request. Please try again.