Ejemplo n.º 1
0
        public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Hashtable hints)
        {
            if (contents == null || contents.Length == 0)
            {
                throw new System.ArgumentException("Found empty contents");
            }

            if (format != BarcodeFormat.QR_CODE)
            {
                throw new System.ArgumentException("Can only encode QR_CODE, but got " + format);
            }

            if (width < 0 || height < 0)
            {
                throw new System.ArgumentException("Requested dimensions are too small: " + width + 'x' + height);
            }

            ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
            if (hints != null)
            {
                ErrorCorrectionLevel requestedECLevel = (ErrorCorrectionLevel) hints[EncodeHintType.ERROR_CORRECTION];
                if (requestedECLevel != null)
                {
                    errorCorrectionLevel = requestedECLevel;
                }
            }

            QRCode code = new QRCode();
            Encoder.encode(contents, errorCorrectionLevel, hints, code);
            return renderResult(code, width, height);
        }
Ejemplo n.º 2
0
 public override ByteMatrix encode(string contents, BarcodeFormat format, int width, int height, Hashtable hints)
 {
     if (format != BarcodeFormat.CODE_39) {
         throw new ArgumentException("Can only encode CODE_39, but got " + format);
     }
     return base.encode(contents, format, width, height, hints);
 }
Ejemplo n.º 3
0
        private const int codeWidth = 3 + (7 * 6) + 5 + (7 * 6) + 3; // end guard

        #endregion Fields

        #region Methods

        public override ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Hashtable hints)
        {
            if (format != BarcodeFormat.EAN_13)
            {
                throw new System.ArgumentException("Can only encode EAN_13, but got " + format);
            }

            return base.encode(contents, format, width, height, hints);
        }
Ejemplo n.º 4
0
        public virtual ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Hashtable hints)
        {
            if (contents == null || contents.Length == 0)
            {
                throw new System.ArgumentException("Found empty contents");
            }

            if (width < 0 || height < 0)
            {
                throw new System.ArgumentException("Requested dimensions are too small: " + width + 'x' + height);
            }

            sbyte[] code = encode(contents);
            return renderResult(code, width, height);
        }
Ejemplo n.º 5
0
 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height)
 {
     return encode(contents, format, width, height, null);
 }