Introduction
The attached assembly, used with the associated font, allows a developer to format UPC-A barcodes from any .NET project in just a few lines of code, as demonstrated here.
Highly skippable backgrounder
The Universal Product Code (UPC) specifications include three versions: A, D, and E. Version A, the regular version, is used to encode a twelve digit number. Version E, the zero suppressed version, is a six digit code used for marking small packages. Version D, the variable length version, is not commonly used for package marking. It is used in limited special applications.
Both Version A and E may include either a 2 digit or a 5 digit supplemental encoding. These extra digits are primarily used on periodicals and books. Supplemental encodings are supported.
Version A encodes a twelve digit number. The first number encoded is the number system character, the next ten digits are the data characters, and the last digit is the check character.
The number system character is printed in human readable form to the left of the UPC symbol. Seven of the ten possible numbers have been assigned.
UPC Number System Characters
Character | Usage |
0 | Regular UPC codes |
1 | Reserved |
2 | Random weight items which are symbol marked at the store level |
3 | National Drug Code and National Health related Items Code |
4 | For use without code format restrictions and with check digit protection for in-store marking of non-food items. |
5 | For use on coupons |
6 | Regular UPC codes |
7 | Regular UPC codes |
8 | Reserved |
9 | Reserved |
These number system characters are accessible as the UPCA.NumberSystem
property of the UPCA
object in the assembly.
Assembly Usage
In order to use the assembly and format UPC-A barcodes, download the attached zip files, unzip them, and follow the steps outlined below:
- First ensure that the UPCA font is installed on the target system
- Navigate to Control Panel and click on it to open.
- Double click fonts in Control Panel to open the Fonts Control Panel applet.
- Either drag the UPCA font into the fonts cache (the Fonts Control Panel applet) or click File->Install new font… navigate to the UPCA font, and select it.
- Add the UPCA assembly to your project in the following manner:
- Copy the assembly to your project folder.
- Add a reference to the assembly in your project.
- Add the
using
clause as below:
using ako.UPC_A;
- You can now construct a
UPCA
object and call its methods in the following manner (also see the attached example project).
- Construct a
UPCA
object with a number system and barcode data (assuming the rich text box font is set to the UPCA font).
richTextBox1.Text = new UPCA(number_system, textBox1.Text).upca;
or…
- Construct a
UPCA
object, then set the NumberSystem
and Data
properties (assuming the rich text box font is set to the UPCA font).
UPCA upc = new UPCA();
upc.NumberSystem = "4";
upc.Data = textBox1.Text;
richTextBox1.Text = upc.upca;
- Obtain the formatted barcode from the
UPCA
property of the UPCA
object e.g. (if declared as in (ii.) above):
richTextBox1.Text = upc.upca;
Notes
- The UPCA object is declared as a partial class, allowing a user to extend its functionality as required (reference .NET partial classes). The actual declaration is shown below:
public partial class UPCA : System.Object
- The read only
UPCA.upca
property is formatted to include all the data required for a properly formatted UPC-A barcode, including leading and trailing barcode stop characters, distinct left and right barcode characters, and the middle barcode characters. - The UPCA font is free for personal, non-commercial use, but requires licensing for commercial use. If you require the font for commercial purposes, please contact me (agolakisira@gmail.com) for details.
History
First version and first article; any and all comments appreciated.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.