iTextSharp.text.pdf.BarcodePostnet.GetBarsPostnet C# (CSharp) Метод

GetBarsPostnet() публичный статический Метод

public static GetBarsPostnet ( string text ) : byte[]
text string
Результат byte[]
        public static byte[] GetBarsPostnet(string text) {
            int total = 0;
            for (int k = text.Length - 1; k >= 0; --k) {
                int n = text[k] - '0';
                total += n;
            }
            text += (char)(((10 - (total % 10)) % 10) + '0');
            byte[] bars = new byte[text.Length * 5 + 2];
            bars[0] = 1;
            bars[bars.Length - 1] = 1;
            for (int k = 0; k < text.Length; ++k) {
                int c = text[k] - '0';
                Array.Copy(BARS[c], 0, bars, k * 5 + 1, 5);
            }
            return bars;
        }