POSTNET
barcodes are those little barcodes that appear on
USPS domestic
mail with two different heights of
bars.
The barcode can encode only the ZIP code or ZIP+4 code (both with a check digit), but generally encodes an 11-digit ZIP+4 plus delivery point code.
The specific method of encoding is this:
There is a start and stop bar (both full-height), between those, each full-height bar is a one and each half-height is a zero, with a binary-coded decimal like scheme. From right to left, the value of the places are 0, 1, 2, 4 and 7. (yes, 0 and 7 are correct) Each decimal digit is encoded by 5 bars. There are *always* two ones (full bars) in each digit in this scheme.
val: 74210 74210
1. 00011 ...||
2. 00101 ..|.|
3. 00110 ..||.
4. 01001 .|..|
5. 01010 .|.|.
6. 01100 .||..
7. 10001 |...|
8. 10010 |..|.
9. 10100 |.|..
0. 11000 ||... (Yes, 7+4=11, but it really means 0 for these purposes)
The delivery point is simply the last 2 digits of the numeric portion of the address (steet address, post office box, rural route number or highway contract number). For instance, with my address, "PO Box 513", 13 is the delivery point. With "1234 Fake Dr.", it would be 34.
The check digit is always the digit that, when added to the sum of the other digits in the barcode, results in a total that is a multiple of 10. (For instance, ZIP+4 barcode 12345-6789 sums to 45, so check digit is 5, to get to 50) Another way to define that is 10 - (sum % 10) where % is the modulus operator.
So, then, here's an address, zip+4 and full barcode:
1234 Fake Dr.
Santa Rosa, CA 95402-0513
||.|...|.|..|..|||.....|.|||....|.|....||..||...||..|..|.|..||
<< 9 >< 5 >< 4 >< 0 >< 2 >< 0 >< 5 >< 1 >< 3 >< 3 >< 4 >< 4 >>
< ZIP >< +4 ><delivery><CHK>
(9+5+4+0+2+0+5+1+3+3+4=36, so CHKsum is 4)
You should now know enough to read the barcodes. Now there's a bit more you need to know to write the barcodes.
The nominal horizontal spacing (bar and a space) must be limited to 22 bars (+/- 2 bars) per inch when measured over any .5 inch portion of the barcode. There should be a clear space at least .012 inch but not more than .040 inch between individual bars.
Five-digit ZIP codes have 32 bars. Nine-digit ZIP+4 codes have 52 bars and Eleven Digit Delivery Point codes have 62 bars.
Tall bars should be between 0.115 inch and 0.135 inch in height. (0.125 +/- 0.010) Short bars should be between 0.040 inch and 0.060 inch in height. (0.050 +/- 0.010) Bars should be between 0.015 inch and 0.025 inch wide. (0.020 +/- 0.005) Distance between bars (trailing edge to leading edge) should be between 0.012 inch and 0.040 inch.
The barcode itself should be either completely contained within a 0.625" high by 4.750" wide area to the lower left-hand edge of the envelope, or in the address block. The bottom of the address block is 0.625" from the bottom of the envelope, with a 0.500 margin on the left and right, except that the leftmost edge of address block can be no more than 10.500 from right edge of the envelope. The top can be no more than 4 inches from the bottom of the envelope. (It's okay if the name of the recipient, or other information mostly irrelevant to the post office is above that)
The entire barcode can't tilt (skew) more than 5 degrees from horizontal and the individual barcodes can't tilt more than 5 degrees from vertical. (combined tilt also counts as bad) Basically, the barcode readers read each bar individually.
The baseline (bottom line) of the barcodes can't vary by more than 0.015 inch from bar to bar.
The background behind the barcode must reflect 50 percent of red and 45 percent of green (indirect reflection, not mirror-like reflection). The ink must reflect differently than the background by at least 30 percent in the red and green portions of the spectrum. These reflectance measures are determined by particular USPS equipment.
Don't let ink spread out too much, and don't leave spaces (like bad dot matrix printers can do) in the barcode.
That *should* cover everything you need to know, if not, read chapter 5 of Publication 25 from the USPS, titled "Designing Letter Mail". That's where I got most of this information from in the first place.