CPC Binary Barcode - Generating Barcodes

Generating Barcodes

  1. Disregarding the space, divide the postal code into four subfields (e.g. K1-A-0-B1).
  2. Locate the contents of each subfield in the encoding tables below and record the hexadecimal numbers that they correspond to. (e.g. K1-A-0-B1 becomes 32-07-A-C2.)
  3. Convert those hex numbers to binary, and add leading zeroes where required.
  4. Change the binary numbers into bars. "Zero" bits in the resulting binary numbers correspond to spaces in the barcode, while "one" bits correspond to printed bars, with the least significant bit of each number corresponding to the rightmost bar in each subfield of the barcode.
  5. Add an "alignment" bar onto the end of the resulting barcode.
  6. Count up the number of bars you have. If you get an even number, add another bar onto the start of the barcode.

Here are some examples of encoded postal codes. The colour used in these examples is meant to simulate the actual colour of the ink used to print the barcodes, however it does not exactly match. Select these examples to make them more visible.

A1B 2C3: | ||| | || | || || |||
K1A 0B1: | || | |||| | || | |
V6B 2R5: | | || || | | | | | ||

Read more about this topic:  CPC Binary Barcode