Example #1
0
        internal static EanUpcSupplement GetSupplementBarCode(EanUpc baseBarCode, string data)
        {
            switch (data.Length)
            {
            case 2: return(new EanUpc2DigitSupplement(baseBarCode));

            case 5: return(new EanUpc5DigitSupplement(baseBarCode));

            default: throw new BarCodeFormatException("Supplement barcode has incorrect length.");
            }
        }
Example #2
0
        public EanUpcSupplement(EanUpc baseBarCode)
        {
            ImportSettings(baseBarCode);
            BarHeight = baseBarCode.BarHeight + baseBarCode.GuardExtraHeight - baseBarCode.TextHeight;

            // text position on top
            if (baseBarCode.TextPosition == TextPosition.Bottom)
            {
                TextPosition = TextPosition.Top;
            }
            else
            {
                TextPosition = baseBarCode.TextPosition;
            }
        }
Example #3
0
        protected void Draw(IBarCodeBuilder builder, string data, string parity, float x, float y)
        {
            // encode the symbol
            BitArray[] encoded = EanUpc.EncodeLeft(data, ParityEncoder.Encode(parity));

            // draw the bars; size and background have already been set by the base barcode
            float textX = x + TotalWidth / 2;

            y += OffsetHeight + TextHeight;
            x  = DrawSymbol(builder, x, y, BarHeight, LeftGuard);
            x  = DrawSymbol(builder, x, y, BarHeight, encoded[0]);
            for (int i = 1; i < encoded.Length; ++i)
            {
                x = DrawSymbol(builder, x, y, BarHeight, SeparatorBar);
                x = DrawSymbol(builder, x, y, BarHeight, encoded[i]);
            }

            // draw the text string
            DrawText(builder, true, new float[] { textX }, y - TextHeight, new string[] { data });
        }
Example #4
0
 public EanUpc5DigitSupplement(EanUpc baseBarCode) :
     base(baseBarCode)
 {
     Checksum = new EanUpc5DigitSupplementChecksum();
 }
Example #5
0
 public EanUpc2DigitSupplement(EanUpc baseBarCode) : base(baseBarCode)
 {
 }