コード例 #1
0
        public void GetPrintDataTest3()
        {
            ZebraZplII target = new ZebraZplII();

            BarCodeType barCodeType = BarCodeType.TestOnlyDoNotUse;

            target.BarCodeType = barCodeType;

            List <string> descriptiveTextLines = new List <string>();

            descriptiveTextLines.Add("aaaaa");
            descriptiveTextLines.Add("bbbbb");
            descriptiveTextLines.Add("ccccc");
            target.DescriptiveTextLines = descriptiveTextLines;

            string barCodeText = "123456";
            string actual;

            bool exceptionThrown = false;

            try
            {
                actual = target.GetPrintData(barCodeText);
            }
            catch (ArgumentException)
            {
                exceptionThrown = true;
            }

            Assert.IsTrue(exceptionThrown, "ArgumentException was not thrown as expected for bad BarCodeType");
        }
コード例 #2
0
ファイル: ShareLib.cs プロジェクト: ewin66/CsharpProjects
        /// <summary>
        /// 类型转换
        /// </summary>
        /// <param name="codeType"></param>
        /// <returns></returns>
        public static BarcodeLib.TYPE Convert(BarCodeType codeType)
        {
            switch (codeType)
            {
            case BarCodeType.Code128:
                return(BarcodeLib.TYPE.CODE128);

            case BarCodeType.Code128A:
                return(BarcodeLib.TYPE.CODE128A);

            case BarCodeType.Code128B:
                return(BarcodeLib.TYPE.CODE128B);

            case BarCodeType.Code128C:
                return(BarcodeLib.TYPE.CODE128C);

            case BarCodeType.Code39:
                return(BarcodeLib.TYPE.CODE39);

            case BarCodeType.EAN13:
                return(BarcodeLib.TYPE.EAN13);

            case BarCodeType.EAN8:
                return(BarcodeLib.TYPE.EAN8);

            default:
                throw new Exception(string.Format("类型{0} 当前还不支持", codeType));
            }
        }
コード例 #3
0
 /// <summary>
 /// Encodes the raw data into binary form representing bars and spaces.  Also generates an Image of the barcode.
 /// </summary>
 /// <param name="iType">Type of encoding to use.</param>
 /// <param name="Data">Raw data to encode.</param>
 /// <returns>Image representing the barcode.</returns>
 public static Image DoEncode(BarCodeType iType, string Data)
 {
     using (BarcodeLib b = new BarcodeLib())
     {
         return(b.Encode(iType, Data));
     }//using
 }
コード例 #4
0
 /// <summary>
 /// Encodes the raw data into binary form representing bars and spaces.  Also generates an Image of the barcode.
 /// </summary>
 /// <param name="iType">Type of encoding to use.</param>
 /// <param name="Data">Raw data to encode.</param>
 /// <param name="IncludeLabel">Include the label at the bottom of the image with data encoded.</param>
 /// <returns>Image representing the barcode.</returns>
 public static Image DoEncode(BarCodeType iType, string Data, bool IncludeLabel)
 {
     using (BarcodeLib b = new BarcodeLib())
     {
         b.IncludeLabel = IncludeLabel;
         return(b.Encode(iType, Data));
     }//using
 }
コード例 #5
0
 /// <summary>
 /// Encodes the raw data into binary form representing bars and spaces.  Also generates an Image of the barcode.
 /// </summary>
 /// <param name="iType">Type of encoding to use.</param>
 /// <param name="Data">Raw data to encode.</param>
 /// <param name="IncludeLabel">Include the label at the bottom of the image with data encoded.</param>
 /// <param name="DrawColor">Foreground color</param>
 /// <param name="BackColor">Background color</param>
 /// <param name="Width">Width of the resulting barcode.(pixels)</param>
 /// <param name="Height">Height of the resulting barcode.(pixels)</param>
 /// <returns>Image representing the barcode.</returns>
 public static Image DoEncode(BarCodeType iType, string Data, bool IncludeLabel, Color DrawColor, Color BackColor, int Width, int Height)
 {
     using (BarcodeLib b = new BarcodeLib())
     {
         b.IncludeLabel = IncludeLabel;
         return(b.Encode(iType, Data, DrawColor, BackColor, Width, Height));
     }//using
 }
コード例 #6
0
ファイル: Commands.cs プロジェクト: fossabot/ESCPOS
        /// <summary>
        /// GS k m n
        /// </summary>
        public static byte[] PrintBarCode(BarCodeType barCodeType, string barCode, int heightInDots = 162)
        {
            var height   = new byte[] { 0x1D, 0x68, (byte)heightInDots };
            var settings = new byte[] { 0x1D, 0x6B, (byte)barCodeType, (byte)barCode.Length };
            var bar      = Encoding.UTF8.GetBytes(barCode);

            return(height.Add(settings, bar));
        }
コード例 #7
0
 /// <summary>
 /// Encodes the raw data into binary form representing bars and spaces.  Also generates an Image of the barcode.
 /// </summary>
 /// <param name="iType">Type of encoding to use.</param>
 /// <param name="Data">Raw data to encode.</param>
 /// <param name="XML">XML representation of the data and the image of the barcode.</param>
 /// <returns>Image representing the barcode.</returns>
 public static Image DoEncode(BarCodeType iType, string Data, ref string XML)
 {
     using (BarcodeLib b = new BarcodeLib())
     {
         Image i = b.Encode(iType, Data);
         XML = b.XML;
         return(i);
     }//using
 }
コード例 #8
0
        public void TestParsingBelowMinimal()
        {
            BarCodeType         type        = BarCodeType.Interleaved25;
            NameValueCollection querystring = new NameValueCollection();

            querystring.Add(QueryStringSerializer.TYPE_KEY, type.ToString());

            IBarCodeSettings settings = QueryStringSerializer.ParseQueryString(querystring);
        }
コード例 #9
0
        public void BarCodeTypeTest()
        {
            LabelPrinter target   = new LabelPrinter();
            BarCodeType  expected = BarCodeType.Code128;
            BarCodeType  actual;

            target.BarCodeType = expected;
            actual             = target.BarCodeType;
            Assert.AreEqual(expected, actual);
        }
コード例 #10
0
        public void LabelPrinterConstructorTest()
        {
            // Run to look for exceptions.

            BarCodeType   barCodeType          = BarCodeType.Code128;
            List <string> descriptiveTextLines = null;
            string        barCodeText          = string.Empty;
            LabelPrinter  target = new LabelPrinter(barCodeType, descriptiveTextLines, barCodeText);

            Assert.IsNotNull(target);
        }
コード例 #11
0
 private ZXing.BarcodeFormat BarcodeToZxing(BarCodeType format)
 {
     foreach (ZXing.BarcodeFormat type in Enum.GetValues(typeof(ZXing.BarcodeFormat)))
     {
         if (format.ToString().Equals(type.ToString()))
         {
             return(type);
         }
     }
     return(ZXing.BarcodeFormat.QR_CODE);
 }
コード例 #12
0
        /// <summary>
        /// Asserts the valid generation of a barcode image.
        /// </summary>
        /// <param name="type">The barcode type to render.</param>
        /// <param name="data">The data to render.</param>
        private void AssertBarcode(BarCodeType type, string data)
        {
            BarCodeSettings settings = new BarCodeSettings();

            settings.Type = type;
            settings.Data = data;
            BarCodeGenerator generator = new BarCodeGenerator(settings);

            using (var image = generator.GenerateImage()) {
                AssertImage(image);
            }
        }
コード例 #13
0
        /// <summary>
        ///  Recognize barcode from a url.
        /// </summary>
        /// <param name="type">Barcode type.</param>
        /// <param name="checksumValidation">Checksum validation parameter</param>
        /// <param name="stripFNC">Allows to strip FNC symbol in recognition results.</param>
        /// <param name="url">The image file url.</param>
        /// <param name="rotationAngle">Recogniton of rotated barcode. Possible angles are 90, 180, 270, default is 0</param>
        /// <returns>BarcodeResponse object with barcode data.</returns>
        public BarcodeResponse RecognizeBarCodeFromUrl(BarCodeType type, ChecksumValidation checksumValidation, bool stripFNC, string url, int rotationAngle = 0)
        {
            // POST barcode/recognize?appSid={appSid}&type={type}&checksumValidation={checksumValidation}&stripFNC={stripFNC}&rotationAngle={rotationAngle}&url={url}

            string apiUrl = string.Format(@"barcode/recognize?type={0}&checksumValidation={1}&stripFNC={2}&rotationAngle={3}&url={4}",
                                          type, checksumValidation, stripFNC, rotationAngle, url);

            JObject         jObject         = JObject.Parse(ServiceController.Post(apiUrl, AppSid, AppKey));
            BarcodeResponse barcodeResponse = jObject.ToObject <BarcodeResponse>();

            return(barcodeResponse);
        }
コード例 #14
0
        public void TestParsingInvalidKey()
        {
            BarCodeType         type        = BarCodeType.Code128;
            string              data        = "123456";
            NameValueCollection querystring = new NameValueCollection();

            querystring.Add(QueryStringSerializer.TYPE_KEY, type.ToString());
            querystring.Add(QueryStringSerializer.DATA_KEY, data);
            querystring.Add("InvalidKey", "whatever");

            IBarCodeSettings settings = QueryStringSerializer.ParseQueryString(querystring);
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name">The image name.</param>
        /// <param name="type">The barcode type.</param>
        /// <param name="checksumValidation">Checksum validation parameter.</param>
        /// <param name="stripFNC">Allows to strip FNC symbol in recognition results.</param>
        /// <param name="barcodesCount">Count of barcodes to recognize.</param>
        /// <param name="rectX">Top left point X coordinate of  to recognize barcode inside.</param>
        /// <param name="rectY">Top left point Y coordinate of  to recognize barcode inside.</param>
        /// <param name="rectWidth">Width of  to recognize barcode inside.</param>
        /// <param name="rectHeight">Height of  to recognize barcode inside.</param>
        /// <param name="storage">The image storage.</param>
        /// <param name="folder">The image folder.</param>
        /// <param name="rotationAngle">Recogniton of rotated barcode. Possible angles are 90, 180, 270, default is 0</param>
        /// <returns>BarcodeResponse object with barcode data.</returns>
        public BarcodeResponse RecognizeBarCodeFromFileOnServer(string name, BarCodeType type, ChecksumValidation checksumValidation, bool stripFNC, int barcodesCount,
                                                                int rectX, int rectY, int rectWidth, int rectHeight, string storage, string folder, int rotationAngle = 0)
        {
            // GET  barcode/{name}/recognize?appSid={appSid}&type={type}&checksumValidation={checksumValidation}&stripFNC={stripFNC}&rotationAngle={rotationAngle}&barcodesCount={barcodesCount}&rectX={rectX}&rectY={rectY}&rectWidth={rectWidth}&rectHeight={rectHeight}&storage={storage}&folder={folder}

            string apiUrl = string.Format(@"barcode/{0}/recognize?type={1}&checksumValidation={2}&stripFNC={3}&rotationAngle={4}&barcodesCount={5}&rectX={6}&rectY={7}&rectWidth={8}&rectHeight={9}&storage={10}&folder={11}",
                                          name, type, checksumValidation, stripFNC, rotationAngle, barcodesCount, rectX, rectY, rectWidth, rectHeight, storage, folder);

            JObject         jObject         = JObject.Parse(ServiceController.Get(apiUrl, AppSid, AppKey));
            BarcodeResponse barcodeResponse = jObject.ToObject <BarcodeResponse>();

            return(barcodeResponse);
        }
コード例 #16
0
        public void TestParsingMinimal()
        {
            BarCodeType         type        = BarCodeType.Code128;
            string              data        = "123456";
            NameValueCollection querystring = new NameValueCollection();

            querystring.Add(QueryStringSerializer.TYPE_KEY, type.ToString());
            querystring.Add(QueryStringSerializer.DATA_KEY, data);

            IBarCodeSettings settings = QueryStringSerializer.ParseQueryString(querystring);

            Assert.AreEqual(type, settings.Type, "Barcode type differs");
            Assert.AreEqual(data, settings.Data, "Barcode data differs");
        }
コード例 #17
0
ファイル: Commands.cs プロジェクト: igorocampos/ESCPOS
        /// <summary>
        /// GS k m n
        /// </summary>
        /// <exception cref="ArgumentNullException"><paramref name="barCode"/> is <see langword="null"/>.</exception>
        public static byte[] PrintBarCode(BarCodeType barCodeType, string barCode, int heightInDots = 162)
        {
            var height = new byte[] { 0x1D, 0x68, (byte)heightInDots };
            var length = barCode.Length;
            var bar    = Encoding.UTF8.GetBytes(barCode);

            if (barCodeType == BarCodeType.CODE128)
            {
                length += 2;
                bar     = new byte[] { 0x7B, 0x42 }.Add(bar); //Subset CODE B is selected for CODE128 bars
            }
            var settings = new byte[] { 0x1D, 0x6B, (byte)barCodeType, (byte)length };

            return(height.Add(settings, bar));
        }
コード例 #18
0
        void setUIValueByBarCodeData(BarCodeComponent barCodeData)
        {
            BarCodeInfo   = barCodeData.BarCodeInfo;
            BarCodeWidth  = barCodeData.BarCodeWidth;
            BarCodeHeight = barCodeData.BarCodeHeight;
            BarCodeCore.EnCodeDraw drawer = new BarCodeCore.EnCodeDraw();
            barCodeGrid.Children.Clear();
            barCodeGrid.Children.Add(drawer.DrawImg39(BarCodeInfo, BarCodeWidth, BarCodeHeight));
            CenterPoint = new Point(barCodeData.PositionX, barCodeData.PositionY);
            BarCodeType type = (BarCodeType)Enum.Parse(typeof(BarCodeType), barCodeData.BarCodeType, true);
            MergePictureRepeatDirection repeatDirection = (MergePictureRepeatDirection)Enum.Parse(typeof(MergePictureRepeatDirection), barCodeData.RepeatDirection, true);

            Type            = type;
            RepeatDirection = repeatDirection;
        }
コード例 #19
0
        /// <summary>
        /// Default implementation of printing functionality.  For debugging purposes only.
        /// </summary>
        /// <param name="barCodeType"></param>
        /// <param name="descriptiveTextLines"></param>
        /// <param name="barCodeText"></param>
        /// <returns></returns>
        private string PrintDataToString(BarCodeType barCodeType, List <string> descriptiveTextLines, string barCodeText)
        {
            var output = new StringBuilder();

            output.AppendFormat("Type: {0}\n", barCodeType.ToString());

            for (int i = 0; i < descriptiveTextLines.Count; ++i)
            {
                output.AppendFormat("Text {0}: {1}\n", i, descriptiveTextLines[i]);
            }

            output.AppendLine(barCodeText);

            return(output.ToString());
        }
コード例 #20
0
        /// <summary>
        /// Generate barcode, the generated barcode image will be saved on provided disk location
        /// </summary>
        /// <param name="text">The code text</param>
        /// <param name="type">Barcode type</param>
        /// <param name="format">Result format</param>
        /// <param name="enableChecksum">Sets if checksum will be generated</param>
        /// <param name="localPathWithFileNameAndExtension">Local disk path with filename and extension to save the generated barcode image. It will overwrite the file if it already exists</param>
        /// <param name="resolutionX">Horizontal resolution in DPI. Default is 96</param>
        /// <param name="resolutionY">Vertical resolution in DPI. Default is 96</param>
        /// <param name="dimensionX">Smallest width of barcode unit (bar or space). Default is 0.7</param>
        /// <param name="dimensionY">Smallest height of barcode unit (for 2D barcodes). Default is 2</param>
        public void GenerateBarCode(string text, BarCodeType type, BarCodeImageFormat format, string localPathWithFileNameAndExtension,
                                    EnableChecksum enableChecksum = EnableChecksum.No, float resolutionX = 96, float resolutionY = 96, double dimensionX = 0.7, float dimensionY = 2)
        {
            // GET barcode/generate?appSid={appSid}&text={text}&type={type}&format={format}&resolutionX={resolutionX}
            //                                &resolutionY={resolutionY}&dimensionX={dimensionX}&dimensionY={dimensionY}&enableChecksum={enableChecksum} 

            string apiUrl = string.Format(@"barcode/generate?text={0}&type={1}&format={2}&resolutionX={3}&resolutionY={4}&dimensionX={5}&dimensionY={6}&enableChecksum={7}",
                                            text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, enableChecksum);

            using (Stream responseStream = ServiceController.GetStream(apiUrl, AppSid, AppKey))
            using (Stream file = File.OpenWrite(localPathWithFileNameAndExtension))
            {
                ServiceController.CopyStream(responseStream, file);
            }
        }
コード例 #21
0
        /// <summary>
        /// Generate barcode, the generated barcode image will be saved on provided disk location
        /// </summary>
        /// <param name="text">The code text</param>
        /// <param name="type">Barcode type</param>
        /// <param name="format">Result format</param>
        /// <param name="enableChecksum">Sets if checksum will be generated</param>
        /// <param name="localPathWithFileNameAndExtension">Local disk path with filename and extension to save the generated barcode image. It will overwrite the file if it already exists</param>
        /// <param name="resolutionX">Horizontal resolution in DPI. Default is 96</param>
        /// <param name="resolutionY">Vertical resolution in DPI. Default is 96</param>
        /// <param name="dimensionX">Smallest width of barcode unit (bar or space). Default is 0.7</param>
        /// <param name="dimensionY">Smallest height of barcode unit (for 2D barcodes). Default is 2</param>
        public void GenerateBarCode(string text, BarCodeType type, BarCodeImageFormat format, string localPathWithFileNameAndExtension,
                                    EnableChecksum enableChecksum = EnableChecksum.No, float resolutionX = 96, float resolutionY = 96, double dimensionX = 0.7, float dimensionY = 2)
        {
            // GET barcode/generate?appSid={appSid}&text={text}&type={type}&format={format}&resolutionX={resolutionX}
            //                                &resolutionY={resolutionY}&dimensionX={dimensionX}&dimensionY={dimensionY}&enableChecksum={enableChecksum}

            string apiUrl = string.Format(@"barcode/generate?text={0}&type={1}&format={2}&resolutionX={3}&resolutionY={4}&dimensionX={5}&dimensionY={6}&enableChecksum={7}",
                                          text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, enableChecksum);

            using (Stream responseStream = ServiceController.GetStream(apiUrl, AppSid, AppKey))
                using (Stream file = File.OpenWrite(localPathWithFileNameAndExtension))
                {
                    ServiceController.CopyStream(responseStream, file);
                }
        }
コード例 #22
0
        /// <summary>
        /// Construct, setting up properties.  Most properties will stay the same after construction.
        /// </summary>
        /// <param name="barCodeType">Type of code to print.</param>
        /// <param name="descriptiveTextLines">Descriptive text to print on the label.</param>
        /// <param name="barCodeText">Bar code value.  This will usually be overridden when calling "Get" functions.</param>
        public LabelPrinter(BarCodeType barCodeType, List <string> descriptiveTextLines, string barCodeText)
        {
            const string tag = ClassName + ".LabelPrinter";

            descriptiveTextLines = (descriptiveTextLines == null) ? new List <string>() : descriptiveTextLines;
            barCodeText          = (barCodeText == null) ? string.Empty : barCodeText;

            if (descriptiveTextLines.Count > MaxDescriptiveTextLineCount)
            {
                throw new ArgumentException(
                          tag + string.Format("descriptiveTextLines has more than {0} entries.", descriptiveTextLines.Count));
            }

            BarCodeType          = barCodeType;
            DescriptiveTextLines = descriptiveTextLines;
            BarCodeText          = barCodeText;
        }
コード例 #23
0
        /// <summary>
        /// See ILabelPrinter.GetPrintData.
        /// </summary>
        public override string GetPrintData(
            BarCodeType barCodeType,
            List <string> descriptiveTextLines,
            string barCodeText)
        {
            const string tag = ClassName + ".GetPrintData:";

            // Check arguments and fill with blanks if missing.
            //

            string zebraBarCodeDesignator;

            switch (barCodeType)
            {
            case BarCodeType.Code128:
                zebraBarCodeDesignator = ZplBarCodeDesignatorCode128;
                break;

            default:
                throw new ArgumentException(
                          tag + string.Format("BarCodeType {0} not supported.", barCodeType.ToString()));
            }

            descriptiveTextLines = (descriptiveTextLines == null) ? new List <string>() : descriptiveTextLines;
            barCodeText          = (barCodeText == null) ? string.Empty : barCodeText;

            // Load our 3 descriptive lines with text.
            //

            string descriptionLine1 = (descriptiveTextLines.Count < 1) ? string.Empty : descriptiveTextLines[0];
            string descriptionLine2 = (descriptiveTextLines.Count < 2) ? string.Empty : descriptiveTextLines[1];
            string descriptionLine3 = (descriptiveTextLines.Count < 3) ? string.Empty : descriptiveTextLines[2];

            // Generate output
            //

            string output = string.Format(
                PrintFormat,
                descriptionLine1,
                descriptionLine2,
                descriptionLine3,
                zebraBarCodeDesignator,
                barCodeText);

            return(output);
        }
コード例 #24
0
        /// <summary>
        ///  Generate barcode and save on server
        /// </summary>
        /// <param name="name">The image name.</param>
        /// <param name="text">Barcode's text.</param>
        /// <param name="type">The barcode type.</param>
        /// <param name="format">The image format.</param>
        /// <param name="codeLocation">Property of the barcode.</param>
        /// <param name="grUnit">Measurement of barcode properties.</param>
        /// <param name="autoSize">Sets if barcode size will be updated automatically.</param>
        /// <param name="barHeight">Height of the bar.</param>
        /// <param name="imageHeight">Height of the image.</param>
        /// <param name="imageWidth">Width of the image.</param>
        /// <param name="imageQuality">Determines quality of the barcode image.</param>
        /// <param name="rotAngle">Angle of barcode orientation.</param>
        /// <param name="topMargin">Top margin.</param>
        /// <param name="bottomMargin">Bottom margin.</param>
        /// <param name="leftMargin">Left margin.</param>
        /// <param name="rightMargin">Right margin.</param>
        /// <param name="enableChecksum">Sets if checksum will be generated.</param>
        /// <param name="storage">Image's storage.</param>
        /// <param name="folder">Image's folder.</param>
        /// <param name="resolutionX">Horizontal resolution in DPI. Default is 96</param>
        /// <param name="resolutionY">Vertical resolution in DPI. Default is 96</param>
        /// <param name="dimensionX">Smallest width of barcode unit (bar or space). Default is 0.7</param>
        /// <param name="dimensionY">Smallest height of barcode unit (for 2D barcodes). Default is 2</param>
        public void GenerateBarCodeAndSaveOnServer(string name, string text, BarCodeType type,
                                                   float barHeight, float imageHeight, float imageWidth, float rotAngle,
                                                   float topMargin, float bottomMargin, float leftMargin, float rightMargin, string storage,
                                                   string folder,
                                                   BarCodeImageFormat format = BarCodeImageFormat.PNG, CodeLocation codeLocation = CodeLocation.Below, GrUnit grUnit = GrUnit.MM,
                                                   bool autoSize             = true, ImageQuality imageQuality = ImageQuality.Default, EnableChecksum enableChecksum = EnableChecksum.No,
                                                   float resolutionX         = 96, float resolutionY           = 96, double dimensionX = 0.7, float dimensionY = 2)
        {
            // PUT  barcode/{name}/generate?appSid={appSid}&text={text}&type={type}&format={format}&resolutionX={resolutionX}&resolutionY={resolutionY}&dimensionX={dimensionX}&dimensionY={dimensionY}&codeLocation={codeLocation}&grUnit={grUnit}&autoSize={autoSize}&barHeight={barHeight}&imageHeight={imageHeight}&imageWidth={imageWidth}&imageQuality={imageQuality}&rotAngle={rotAngle}&topMargin={topMargin}&bottomMargin={bottomMargin}&leftMargin={leftMargin}&rightMargin={rightMargin}&enableChecksum={enableChecksum}&storage={storage}&folder={folder}

            string apiUrl = string.Format(@"barcode/{0}/generate?text={1}&type={2}&format={3}&resolutionX={4}&resolutionY={5}&dimensionX={6}&dimensionY={7}&codeLocation={8}&grUnit={9}&autoSize={10}&barHeight={11}&imageHeight={12}&imageWidth={13}&imageQuality={14}&rotAngle={15}&topMargin={16}&bottomMargin={17}&leftMargin={18}&rightMargin={19}&enableChecksum={20}&storage={21}&folder={22}",
                                          name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight,
                                          imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum,
                                          storage, folder);

            ServiceController.Put(apiUrl, AppSid, AppKey);
        }
コード例 #25
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="pName"></param>
 public RptBarCode(string pName) : base(pName, DIYReport.ReportModel.RptObjType.BarCode)
 {
     _Align         = AlignType.Center;
     _Code          = "1234567890";
     _LeftMargin    = 5;
     _TopMargin     = 5;
     _Height        = 30;
     _ShowHeader    = false;
     _ShowFooter    = true;
     _HeaderText    = "BarCode";
     _Weight        = BarCodeWeight.Small;
     _HeaderFont    = new Font("Microsoft Sans Serif", 12F);
     _FooterFont    = new Font("Microsoft Sans Serif", 8F);
     _CodeType      = BarCodeType.Code39;
     _WID           = 1f;
     _DrawByBarCode = true;
 }
コード例 #26
0
        /// <summary>
        ///  Generate barcode and save on server
        /// </summary>
        /// <param name="name">The image name.</param>
        /// <param name="text">Barcode's text.</param>
        /// <param name="type">The barcode type.</param>
        /// <param name="format">The image format.</param>
        /// <param name="codeLocation">Property of the barcode.</param>
        /// <param name="grUnit">Measurement of barcode properties.</param>
        /// <param name="autoSize">Sets if barcode size will be updated automatically.</param>
        /// <param name="barHeight">Height of the bar.</param>
        /// <param name="imageHeight">Height of the image.</param>
        /// <param name="imageWidth">Width of the image.</param>
        /// <param name="imageQuality">Determines quality of the barcode image.</param>
        /// <param name="rotAngle">Angle of barcode orientation.</param>
        /// <param name="topMargin">Top margin.</param>
        /// <param name="bottomMargin">Bottom margin.</param>
        /// <param name="leftMargin">Left margin.</param>
        /// <param name="rightMargin">Right margin.</param>
        /// <param name="enableChecksum">Sets if checksum will be generated.</param>
        /// <param name="storage">Image's storage.</param>
        /// <param name="folder">Image's folder.</param>
        /// <param name="resolutionX">Horizontal resolution in DPI. Default is 96</param>
        /// <param name="resolutionY">Vertical resolution in DPI. Default is 96</param>
        /// <param name="dimensionX">Smallest width of barcode unit (bar or space). Default is 0.7</param>
        /// <param name="dimensionY">Smallest height of barcode unit (for 2D barcodes). Default is 2</param>
        public void GenerateBarCodeAndSaveOnServer(string name, string text, BarCodeType type,
                                                   float barHeight, float imageHeight, float imageWidth, float rotAngle,
                                                   float topMargin, float bottomMargin, float leftMargin, float rightMargin, string storage,
                                                   string folder,
                                                   BarCodeImageFormat format = BarCodeImageFormat.PNG, CodeLocation codeLocation = CodeLocation.Below, GrUnit grUnit = GrUnit.MM,
                                                   bool autoSize = true, ImageQuality imageQuality = ImageQuality.Default, EnableChecksum enableChecksum = EnableChecksum.No,
                                                   float resolutionX = 96, float resolutionY = 96, double dimensionX = 0.7, float dimensionY = 2)
        {
            // PUT 	barcode/{name}/generate?appSid={appSid}&text={text}&type={type}&format={format}&resolutionX={resolutionX}&resolutionY={resolutionY}&dimensionX={dimensionX}&dimensionY={dimensionY}&codeLocation={codeLocation}&grUnit={grUnit}&autoSize={autoSize}&barHeight={barHeight}&imageHeight={imageHeight}&imageWidth={imageWidth}&imageQuality={imageQuality}&rotAngle={rotAngle}&topMargin={topMargin}&bottomMargin={bottomMargin}&leftMargin={leftMargin}&rightMargin={rightMargin}&enableChecksum={enableChecksum}&storage={storage}&folder={folder}

            string apiUrl = string.Format(@"barcode/{0}/generate?text={1}&type={2}&format={3}&resolutionX={4}&resolutionY={5}&dimensionX={6}&dimensionY={7}&codeLocation={8}&grUnit={9}&autoSize={10}&barHeight={11}&imageHeight={12}&imageWidth={13}&imageQuality={14}&rotAngle={15}&topMargin={16}&bottomMargin={17}&leftMargin={18}&rightMargin={19}&enableChecksum={20}&storage={21}&folder={22}",
                                            name, text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, codeLocation, grUnit, autoSize, barHeight,
                                            imageHeight, imageWidth, imageQuality, rotAngle, topMargin, bottomMargin, leftMargin, rightMargin, enableChecksum,
                                            storage, folder);

            ServiceController.Put(apiUrl, AppSid, AppKey);
        }
コード例 #27
0
        public BarCode(IContainer container, BarCodeType bt, string binfo, int bw, int bh)
        {
            InitializeComponent();
            _container = container;
            editType   = PageEditType.Add;
            this.Type  = bt;
            //System.Windows.Browser.HtmlPage.Document.AttachEvent("oncontextmenu", OnContextMenu);
            //this.Name = UniqueID;
            BarCodeCore.EnCodeDraw drawer = new BarCodeCore.EnCodeDraw();
            barCodeGrid.Children.Add(drawer.DrawImg39(binfo, bw, bh));

            _doubleClickTimer          = new System.Windows.Threading.DispatcherTimer();
            _doubleClickTimer.Interval = new TimeSpan(0, 0, 0, 0, 400);
            _doubleClickTimer.Tick    += new EventHandler(DoubleClick_Timer);
            Storyboard story = (Storyboard)containerUI.FindResource("sbDisplay");

            story.Begin();
        }
コード例 #28
0
        public byte[] PrintBarcode(BarCodeType type, BarcodeModuleWidth moduleWidth, byte[] data)
        {
            var length = 6 + data.Length;

            var(nl, nh) = Util.SplitNumber(length);
            const int s  = 0;
            const int c  = 0;
            const int v1 = 21;
            const int v2 = 0;

            var command = new List <byte>
            {
                AsciiTable.ESC, AsciiTable.LEFT_PARENTHESIS, AsciiTable.B, (byte)nl, (byte)nh, (byte)type,
                (byte)moduleWidth, s, v1, v2, c
            };

            command.AddRange(data);

            return(command.ToArray());
        }
コード例 #29
0
        public void ZebraZplIIConstructorTest2()
        {
            BarCodeType barCodeType = BarCodeType.Code128;

            List <string> descriptiveTextLines = new List <string>();

            descriptiveTextLines.Add("1");
            descriptiveTextLines.Add("2");
            descriptiveTextLines.Add("3");

            string barCodeText = "123456";

            ZebraZplII target = new ZebraZplII(barCodeType, descriptiveTextLines, barCodeText);

            Assert.IsNotNull(target, "null from constructor");
            Assert.IsTrue(barCodeType == target.BarCodeType, "barCodeType !=");
            Assert.IsTrue(barCodeText == target.BarCodeText, "barCodeText !=");
            Assert.IsTrue(descriptiveTextLines[0] == target.DescriptiveTextLines[0], "descriptiveTextLines[0] !=");
            Assert.IsTrue(descriptiveTextLines[1] == target.DescriptiveTextLines[1], "descriptiveTextLines[1] !=");
            Assert.IsTrue(descriptiveTextLines[2] == target.DescriptiveTextLines[2], "descriptiveTextLines[2] !=");
        }
コード例 #30
0
        public void GetPrintDataTest2()
        {
            var         target      = new LabelPrinter();
            BarCodeType barCodeType = BarCodeType.Code128;

            List <string> descriptiveTextLines = new List <string>();

            descriptiveTextLines.Add("aaaaa");
            descriptiveTextLines.Add("bbbbb");
            descriptiveTextLines.Add("ccccc");

            string barCodeText = "123456";
            string actual;

            actual = target.GetPrintData(barCodeType, descriptiveTextLines, barCodeText);


            Assert.Inconclusive(
                "GetPrintData({0}, {1}, {2})\n{3}",
                barCodeType, descriptiveTextLines, barCodeText, actual);
        }
コード例 #31
0
        /// <summary>
        /// 检查证卡条码
        /// </summary>
        /// <param name="UserCode"></param>
        /// <param name="BoxNOs">输出,箱头号码,如:1,2....</param>
        /// <returns></returns>
        public static BarCodeType CheckCardType(string UserCode, ref string BoxNOs, out string UnitName, out string UserName)
        {
            DateTime dtStart    = DateTime.Now;
            string   LogMessage = "检查证卡条码:" + UserCode + "\r\n";

            BarCodeType rType = BarCodeType.无效;

            BoxNOs   = "";
            UnitName = ""; UserName = "";
            try
            {
                MonitorService_NoLocal.MonitorService_NoLocal obj = GetConnectionObj();

                int i = obj.CheckCardType(UserCode, ref BoxNOs, out UnitName, out UserName);
                //条码类型。0:无效, 1:厂方维修  2:管理员,3:交换员
                if (i == 2)
                {
                    rType = BarCodeType.管理员;
                }
                else if (i == 3)
                {
                    rType = BarCodeType.交换员;
                }

                LogMessage += "返回检查结果,条码类型:" + rType.ToString() + "\r\n";
            }
            catch (Exception ee)
            {
                LogInfo.Log.WriteInfo(LogInfo.LogType.Error, ee.ToString());
                LogMessage += "异常,内容:" + ee.ToString() + "\r\n";
            }

            TimeSpan ts = DateTime.Now - dtStart;

            LogMessage = "耗时 " + ts.ToString() + " 。\r\n" + LogMessage + "\r\n\r\n";
            LogInfo.Log.WriteFileLog(LogMessage);

            return(rType);
        }
コード例 #32
0
        public void GetPrintDataTest2()
        {
            ZebraZplII target = new ZebraZplII();

            BarCodeType barCodeType = BarCodeType.Code128;

            target.BarCodeType = barCodeType;

            List <string> descriptiveTextLines = new List <string>();

            descriptiveTextLines.Add("aaaaa");
            descriptiveTextLines.Add("bbbbb");
            descriptiveTextLines.Add("ccccc");
            target.DescriptiveTextLines = descriptiveTextLines;

            string barCodeText = "123456";
            string actual;

            actual = target.GetPrintData(barCodeText);

            Assert.Inconclusive("GetPrintData({0})\n{1}", barCodeText, actual);
        }
コード例 #33
0
 public static BarCodeRes IdentifyBarCode(Int32Image image, BarCodeType type, SWIGTYPE_p_std__string code, int nrOfChars, int lineDistance, BarCodeScanDir dir) {
   BarCodeRes ret = (BarCodeRes)VisionLabPINVOKE.IdentifyBarCode__SWIG_21(Int32Image.getCPtr(image), (int)type, SWIGTYPE_p_std__string.getCPtr(code), nrOfChars, lineDistance, (int)dir);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #34
0
 private void SetBarCodeIndex(BarCodeType barcode, bool autoSave)
 {
     switch (barcode)
     {
         case BarCodeType.Aztec:
             SetChecked(barCheckItemBarAztec, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemBarAztec.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemBarAztec.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemBarAztec.GlyphDisabled;
             break;
         case BarCodeType.Codabar:
             SetChecked(barCheckItemCodabar, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemCodabar.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemCodabar.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemCodabar.GlyphDisabled;
             break;
         case BarCodeType.Code39:
             SetChecked(barCheckItemCode39, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemCode39.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemCode39.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemCode39.GlyphDisabled;
             break;
         case BarCodeType.Code93:
             SetChecked(barCheckItemCode93, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemCode93.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemCode93.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemCode93.GlyphDisabled;
             break;
         case BarCodeType.Code128:
             SetChecked(barCheckItemCode128, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemCode128.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemCode128.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemCode128.GlyphDisabled;
             break;
         case BarCodeType.DataMatrix:
             SetChecked(barCheckItemDataMatrix, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemDataMatrix.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemDataMatrix.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemDataMatrix.GlyphDisabled;
             break;
         case BarCodeType.EAN:
             SetChecked(barCheckItemEAN, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemEAN.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemEAN.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemEAN.GlyphDisabled;
             break;
         case BarCodeType.InterLeaved2of5:
             SetChecked(barCheckItemInterLeaved2of5, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemInterLeaved2of5.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemInterLeaved2of5.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemInterLeaved2of5.GlyphDisabled;
             break;
         case BarCodeType.PDF417:
             SetChecked(barCheckItemPdf417, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemPdf417.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemPdf417.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemPdf417.GlyphDisabled;
             break;
         case BarCodeType.PostNet:
             SetChecked(barCheckItemPostNet, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemPostNet.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemPostNet.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemPostNet.GlyphDisabled;
             break;
         case BarCodeType.QR:
             SetChecked(barCheckItemQR, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemQR.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemQR.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemQR.GlyphDisabled;
             break;
         case BarCodeType.UPC_A:
             SetChecked(barCheckItemUPC_A, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemUPC_A.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemUPC_A.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemUPC_A.GlyphDisabled;
             break;
         case BarCodeType.UPC_E:
             SetChecked(barCheckItemUPC_E, true);
             barButtonItemDocumentSeperation.LargeGlyph = barCheckItemUPC_E.LargeGlyph;
             barButtonItemType.LargeGlyph = barCheckItemUPC_E.LargeGlyph;
             barCheckItemUsingBarCodes.Glyph = barCheckItemUPC_E.GlyphDisabled;
             break;
     }
     if (autoSave)
     {
         SetChecked(barCheckItemUsingBarCodes, true);
         SetChecked(barButtonItemType, true);
         SetChecked(barButtonItemDocumentSeperation, true);
         appSetting.BarCode = barcode;
     }
 }
コード例 #35
0
        /// <summary>
        ///  Recognize barcode from a url. 
        /// </summary>
        /// <param name="type">Barcode type.</param>
        /// <param name="checksumValidation">Checksum validation parameter</param>
        /// <param name="stripFNC">Allows to strip FNC symbol in recognition results.</param>        
        /// <param name="url">The image file url.</param>
        /// <param name="rotationAngle">Recogniton of rotated barcode. Possible angles are 90, 180, 270, default is 0</param>
        /// <returns>BarcodeResponse object with barcode data.</returns>
        public BarcodeResponse RecognizeBarCodeFromUrl(BarCodeType type, ChecksumValidation checksumValidation, bool stripFNC, string url, int rotationAngle = 0)
        {
            // POST barcode/recognize?appSid={appSid}&type={type}&checksumValidation={checksumValidation}&stripFNC={stripFNC}&rotationAngle={rotationAngle}&url={url}

            string apiUrl = string.Format(@"barcode/recognize?type={0}&checksumValidation={1}&stripFNC={2}&rotationAngle={3}&url={4}",
                                            type, checksumValidation, stripFNC, rotationAngle, url);

            JObject jObject = JObject.Parse(ServiceController.Post(apiUrl, AppSid, AppKey));
            BarcodeResponse barcodeResponse = jObject.ToObject<BarcodeResponse>();
            return barcodeResponse;
        }
コード例 #36
0
ファイル: ProductBarcode.cs プロジェクト: khanhdtn/my-fw-win
        public ProductBarcode(DataSet ds)
        {
            DevExpress.XtraPrinting.PrintingSystem printSys = new DevExpress.XtraPrinting.PrintingSystem();
            this.paperKind = printSys.PageSettings.PaperKind;
            this.widthPage = printSys.PageBounds.Width;
            this.heightPage = printSys.PageBounds.Height;
            this.marginLeft = printSys.PageMargins.Left;
            this.marginRight = printSys.PageMargins.Right;
            this.marginTop = printSys.PageMargins.Top;
            this.marginBottom = printSys.PageMargins.Bottom;

            this.fieldId = "ID";
            this.fieldName = "NAME";
            this.fieldUnit = "UNIT";
            this.fieldQuantity = "QUANTITY";
            this.fieldPrice = "PRICE";

            this.dsProduct = ds;

            //this.spaceCol = 10;
            //this.spaceRow = 10;

            this.spaceCol = 0;
            this.spaceRow = 0;

            this.moduleBarcode = 1F;

            this.borderStamp = 1;

            this.heightUnit = 20;
            this.heightName = 20;
            this.heightPrice = 20;
            this.fontUnit = new Font("Tahoma", 8);
            this.fontName = new Font("Tahoma", 8);
            this.fontPrice = new Font("Tahoma", 8);

            this.symBC = BarCodeType.EAN13;
        }
コード例 #37
0
 public static BarcodeFormat BarcodeToZxing(BarCodeType format)
 {
     return Enum.GetValues(typeof(BarcodeFormat))
             .Cast<BarcodeFormat>().First(code => code.ToString().Equals(format.ToString()));
 }
コード例 #38
0
ファイル: BarcodeUtil.cs プロジェクト: wxll1120/c585b99f
 /// <summary>
 /// 生成条形码图片
 /// </summary>
 /// <param name="codeType">条形码类型</param>
 /// <param name="content">条形码内容</param>
 /// <param name="fontSize">显示字体大小</param>
 /// <param name="imgHeight">CODE图片高度</param>
 /// <param name="imgWidth">CODE图片宽度</param>
 /// <param name="withStart">是否在条形码中填加前后*号(条形码下方显示内容不变)</param>
 public static Image CreateBarcode(BarCodeType codeType, string content,
     float? fontSize, int imgHeight, int? imgWidth, bool withStart)
 {
     Image barCodeImage = null;
     switch (codeType)
     {
         case BarCodeType.Code39:
             barCodeImage = GetCodeImage(content, fontSize, imgHeight,
                 imgWidth, Code39Model.Code39Normal, withStart);
             break;
     }
     return barCodeImage;
 }
コード例 #39
0
		public MediaQRContent (string text, BarCodeType barcodeType, QRType qrType)
		{
			Text = text;
			BarcodeType=barcodeType;
			QRType = qrType;
		}
コード例 #40
0
ファイル: ProductBarcode.cs プロジェクト: khanhdtn/my-fw-win
 /// <summary>
 /// Lấy Generator từ BarCodeType
 /// </summary>
 public BarCodeGeneratorBase GetBCSymbology(BarCodeType sym)
 {
     BarCodeGeneratorBase gen = null;
     switch(sym){
         case BarCodeType.EAN8:
             return new EAN8Generator();
         case BarCodeType.EAN13:
             return new EAN13Generator();
         //case BarCodeType.EAN128:
         //    return new EAN128Generator();
         case BarCodeType.CODE25_INDUSTRIAL:
             gen = new Industrial2of5Generator();
             gen.CalcCheckSum = false;
             return gen;
         case BarCodeType.CODE25_INTERLEAVED:
             gen = new Interleaved2of5Generator();
             gen.CalcCheckSum = false;
             return gen;
         //case BarCodeType.PDF417:
         //    return new PDF417Generator();
         //case BarCodeType.UPCA:
         //    return new UPCAGenerator();
         case BarCodeType.CODE_39:
             gen = new Code39Generator();
             gen.CalcCheckSum = false;
             return gen;
         case BarCodeType.CODE_39_EXT:
             gen = new Code93ExtendedGenerator();
             gen.CalcCheckSum = false;
             return gen;
         case BarCodeType.CODE_93:
             gen = new Code93Generator();
             gen.CalcCheckSum = false;
             return gen;
         case BarCodeType.CODE_93_EXT:
             gen = new Code93ExtendedGenerator();
             gen.CalcCheckSum = false;
             return gen;
         case BarCodeType.CODABAR:
             gen = new CodabarGenerator();
             gen.CalcCheckSum = false;
             return gen;
     }
     return new EAN13Generator();
 }
コード例 #41
0
 public static string BarCodeTypeToStr(BarCodeType t) {
   string ret = VisionLabPINVOKE.BarCodeTypeToStr((int)t);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #42
0
        /// <summary>
        /// Recognition of a barcode from file on server with parameters in body. 
        /// </summary>
        /// <param name="name">The image name.</param>
        /// <param name="barcodeReader">BarcodeReader object with parameters.</param>
        /// <param name="type">The barcode type.</param>
        /// <param name="folder">The image folder.</param>
        /// <returns>BarcodeResponse object with barcode data.</returns>
        public BarcodeResponse RecognizeBarCodeFromFileOnServer(string name, BarCodeReader barcodeReader, BarCodeType type, string folder)
        {
            // PUT 	barcode/{name}/recognize?appSid={appSid}&type={type}&folder={folder}

            string apiUrl = string.Format(@"barcode/{0}/recognize?type={1}&folder={2}", name, type, folder);
            JObject jObject = JObject.Parse(ServiceController.Put(apiUrl, AppSid, AppKey, JsonConvert.SerializeObject(barcodeReader)));
            BarcodeResponse barcodeResponse = jObject.ToObject<BarcodeResponse>();
            return barcodeResponse;
        }
コード例 #43
0
 public static BarCodeRes IdentifyBarCode(Int32Image image, BarCodeType type, SWIGTYPE_p_std__string code) {
   BarCodeRes ret = (BarCodeRes)VisionLabPINVOKE.IdentifyBarCode__SWIG_24(Int32Image.getCPtr(image), (int)type, SWIGTYPE_p_std__string.getCPtr(code));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #44
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name">The image name.</param>
        /// <param name="type">The barcode type.</param>
        /// <param name="checksumValidation">Checksum validation parameter.</param>
        /// <param name="stripFNC">Allows to strip FNC symbol in recognition results.</param>
        /// <param name="barcodesCount">Count of barcodes to recognize.</param>
        /// <param name="rectX">Top left point X coordinate of  to recognize barcode inside.</param>
        /// <param name="rectY">Top left point Y coordinate of  to recognize barcode inside.</param>
        /// <param name="rectWidth">Width of  to recognize barcode inside.</param>
        /// <param name="rectHeight">Height of  to recognize barcode inside.</param>
        /// <param name="storage">The image storage.</param>
        /// <param name="folder">The image folder.</param>
        /// <param name="rotationAngle">Recogniton of rotated barcode. Possible angles are 90, 180, 270, default is 0</param>
        /// <returns>BarcodeResponse object with barcode data.</returns>
        public BarcodeResponse RecognizeBarCodeFromFileOnServer(string name, BarCodeType type, ChecksumValidation checksumValidation, bool stripFNC, int barcodesCount,
                                                                int rectX, int rectY, int rectWidth, int rectHeight, string storage, string folder, int rotationAngle = 0)
        {
            // GET 	barcode/{name}/recognize?appSid={appSid}&type={type}&checksumValidation={checksumValidation}&stripFNC={stripFNC}&rotationAngle={rotationAngle}&barcodesCount={barcodesCount}&rectX={rectX}&rectY={rectY}&rectWidth={rectWidth}&rectHeight={rectHeight}&storage={storage}&folder={folder} 

            string apiUrl = string.Format(@"barcode/{0}/recognize?type={1}&checksumValidation={2}&stripFNC={3}&rotationAngle={4}&barcodesCount={5}&rectX={6}&rectY={7}&rectWidth={8}&rectHeight={9}&storage={10}&folder={11}",
                                            name, type, checksumValidation, stripFNC, rotationAngle, barcodesCount, rectX, rectY, rectWidth, rectHeight, storage, folder);

            JObject jObject = JObject.Parse(ServiceController.Get(apiUrl, AppSid, AppKey));
            BarcodeResponse barcodeResponse = jObject.ToObject<BarcodeResponse>();
            return barcodeResponse;
        }
コード例 #45
0
ファイル: IPhoneMedia.cs プロジェクト: jioe/appverse-mobile
 private ZXing.BarcodeFormat BarcodeToZxing(BarCodeType format)
 {
     foreach(ZXing.BarcodeFormat type in Enum.GetValues(typeof(ZXing.BarcodeFormat))){
         if(format.ToString().Equals(type.ToString())) return type;
     }
     return ZXing.BarcodeFormat.QR_CODE;
 }
コード例 #46
0
 /// <summary>
 /// Constructor with codetext and barcode type
 /// </summary>
 /// <param name="codetext">Barcode value</param>
 /// <param name="barcodeType">Barcode type</param>
 public BarCodeBuilder(String codetext, BarCodeType barcodeType)
 {
     this.BarCodeType = barcodeType;
     this.Codetext = codetext;
     this.ImageFormat = ImageFormat.PNG;
 }