# code-11-matrix

The Code-11-matrix bar code type is used primarily in telecommunications.

Code-11-matrix represents a character string with a variable number of characters. The string can contain the digits 0-9 and the '-' character. The number of digits can be specified by setting the noDigits attribute. The code can contain up to two check characters. The attribute noCheckDigits specifies how many check characters are used. If two check characters are used, the rightmost character is the 'K' checksum character and the last but one character is the 'C' checksum character. If only one checksum character is specified then the rightmost character is a 'C' checksum character. The 'C' checksum is calculated asC=(Sum(i=1 to n of ((i-1 mod 10)+1)*Ref(n-i+1))) mod 11 and the 'K' checksum is calculated usingK=(Sum(i=1 to n of ((i-1 mod 9)+1)*Ref(n-i+1))) mod 11 where n specifies the number of characters to the left of the particular check digit and Ref(i) specifies the value of the character at position i, starting with the leftmost character having the value 1. For digits Ref() yields the digit value itself and for the '-' character Ref() yields the value 10.

For example, to calculate the 'C' checksum, set Code Value to:

``"12-12345-67890", noDigits="16", noCheckDigits="2", n=14C=(1*0+2*9+3*8+4*7+....10*2+1*1+2*10+3*2+4*1) mod 11=305 mod 11=8 ``

The K checksum can then be calculated as: ```n=15, Ref(15)=C=8K=(1*8+2*0+3*9+4*8+....9*4+1*3+2*2+3*1+4*10+5*2+6*1) mod 11=350 mod 11=9```, resulting in a code value of `12-12345-6789089`.

If the value supplied in codeValue has the length noDigits- noCheckDigits then the system automatically calculates and supplies the check digits.

The nominal height is 1 in. Digits can differ in width so that two different values having the same number of digits can result in bar codes of differing width. The nominal width of a thin bar is THINBARWIDTH=0.0236in. The width of a thick bar is THICKBARWIDTH=THINBARWIDTH/ thinToThickRelation where thinToThickRelation should take values between1/3 and1/2. Between digits a gap of width GAPWIDTH=THINBARWIDTH/ thinToGapRelation is drawn. The default relation value is 1. The padding on both sides measures 10*THINBARWIDTH.