Packageardisia.components.barCode.specifications
Classpublic class Upc
InheritanceUpc Inheritance Object

Universal Product Code; see http://en.wikipedia.org/wiki/Universal_Product_Code

See http://www.morovia.com/education/symbology/upc-e.asp and http://www.barcodeisland.com/upce.phtml#Example for notes on conversion of UPC-A to UPC-E.

UPC-A is a 12 digit numerical system (11 with a check). UPC-E is a compressed, 6 digit code.

Both UPC-A and E expect a string length 11 to encode (will ignore the 12th char if provided).

Quiet zone is not automatically added. However, a quiet zone, with a width of at least 9 times the x-dimension, must be present on each side of the scannable area of the UPC-A barcode. UPC-E requires 9 X-dimension units on the left side and 7 on the right. Adding this is up to the developer.



Public Methods
 MethodDefined By
  
encodeForUPC(data:String, UPCcode:String = upca):String
[static] Returns a UPC encoded string.
Upc
Protected Methods
 MethodDefined By
  
convertUPCAtoUPCE(data:String):String
[static] Converts a UPC-A number to a UPC-E encoded number.
Upc
  
getCheckDigit(data:String):String
[static] Calculates and returns the check digit.
Upc
Method Detail
convertUPCAtoUPCE()method
protected static function convertUPCAtoUPCE(data:String):String

Converts a UPC-A number to a UPC-E encoded number.

Parameters

data:String

Returns
String — a UPC-E encoded Number
encodeForUPC()method 
public static function encodeForUPC(data:String, UPCcode:String = upca):String

Returns a UPC encoded string.

Parameters

data:String — the string to encode
 
UPCcode:String (default = upca) — "upca" or "upce" type encoding; default is "upca"

Returns
String — a String of encoded data
getCheckDigit()method 
protected static function getCheckDigit(data:String):String

Calculates and returns the check digit. Assumes that the string has been sanitized.

Parameters

data:String — the String to calculate the check digit

Returns
String — a String of the check digit