public static void Run()
        {
            // ExStart:SetFontandColorSetting
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();

            // Instantiate barcode object
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128);

            generator.Parameters.CaptionAbove.Visible         = true;
            generator.Parameters.CaptionAbove.Text            = "Aspose";
            generator.Parameters.CaptionAbove.Alignment       = TextAlignment.Center;
            generator.Parameters.CaptionAbove.TextColor       = Color.Red;
            generator.Parameters.CaptionAbove.Font.FamilyName = "Pristina";
            generator.Parameters.CaptionAbove.Font.Size.Point = 14;

            generator.Parameters.CaptionBelow.Alignment       = TextAlignment.Center;
            generator.Parameters.CaptionBelow.Text            = "Aspose.Demo";
            generator.Parameters.CaptionBelow.Visible         = true;
            generator.Parameters.CaptionBelow.Font.FamilyName = "Pristina";
            generator.Parameters.CaptionBelow.Font.Size.Point = 14;
            generator.Parameters.CaptionBelow.TextColor       = Color.OrangeRed;

            // Save the image to your system and set its image format to Jpeg
            generator.Save(dataDir + "SetFontandColorSetting_out.jpeg", BarCodeImageFormat.Jpeg);
            // ExEnd:SetFontandColorSetting
        }
示例#2
0
        public static void Run()
        {
            // ExStart:ManageCaption
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodes();

            // Instantiate barcode object and set CodeText & Barcode Symbology
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128, "1234567");

            // Set caption above its text and text alignment & also make it visible
            generator.Parameters.CaptionAbove.Visible         = true;
            generator.Parameters.CaptionAbove.Text            = "Aspose";
            generator.Parameters.CaptionAbove.Alignment       = TextAlignment.Center;
            generator.Parameters.CaptionAbove.TextColor       = Color.Red;
            generator.Parameters.CaptionAbove.Font.FamilyName = "Pristina";
            generator.Parameters.CaptionAbove.Font.Size.Point = 14;
            //space between the barcode and the caption
            //generator.Parameters.CaptionAbove.Space.Millimeters = 5;

            // Assign caption object to be displayed above the barcode
            generator.Parameters.CaptionBelow.Visible         = true;
            generator.Parameters.CaptionBelow.Text            = "Aspose Caption below";
            generator.Parameters.CaptionBelow.Alignment       = TextAlignment.Center;
            generator.Parameters.CaptionBelow.TextColor       = Color.OrangeRed;
            generator.Parameters.CaptionBelow.Font.Size.Point = 14;
            generator.Parameters.CaptionBelow.Font.FamilyName = "Pristina";
            //space between the barcode and the caption
            //generator.CaptionBelow.Space.Millimeters = 5;

            // Save the image to your system and set its image format to Jpeg
            generator.Save(dataDir + "ManageCaption_out.jpg", BarCodeImageFormat.Jpeg);
            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir);
            // ExEnd:ManageCaption
        }
        public static void Run()
        {
            //ExStart:DetectUnicodeEncoding
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();

            try
            {
                MemoryStream memoryStream = new MemoryStream();

                // Instantiate barcode object, Set CodeText, Barcode Symbology and Text Encoding
                using (BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "Слово"))
                {
                    generator.Parameters.Barcode.QR.CodeTextEncoding = Encoding.UTF8;
                    generator.Save(dataDir + "" + memoryStream + "_out.png", BarCodeImageFormat.Png);
                }

                string fileName = dataDir + "" + memoryStream + "_out.png";
                using (BarCodeReader reader = new BarCodeReader(fileName, DecodeType.QR))
                {
                    var detectEnc = reader.DetectEncoding;
                    foreach (BarCodeResult result in reader.ReadBarCodes())
                    {
                        Console.WriteLine(result.CodeText); //"Слово"
                    }
                }
            }
            catch (Exception)
            {}
            //ExEnd:DetectUnicodeEncoding
        }
示例#4
0
        public ResultData Run(StepStartData data)
        {
            // You will have to run another step before this one or provide a license for the Aspose library.
            // Step to run before this one: RecognizeBarcodesFromWordDoc.

            string barCodeText = data[INPUT_BAR_CODE_TEXT] as string;

            if (string.IsNullOrEmpty(barCodeText))
            {
                throw new BusinessRuleException("You cannot generate a bar code without any barcode text.");
            }

            BarcodeGenerator generator = new BarcodeGenerator(GetEncodeTypeFromName(BarcodeEncodingType), barCodeText);

            generator.Parameters.Barcode.XDimension.Millimeters = 1f;
            FileData fdResult = null;

            using (MemoryStream ms = new MemoryStream())
            {
                // Save the image to your system and set its image format to Jpeg
                generator.Save(ms, BarCodeImageFormat.Jpeg);
                fdResult = new FileData("BarCode.jpg", ms.ToArray());
            }

            return(new ResultData(PATH_DONE, new DataPair[] { new DataPair(RESULT_DATA_FILE, fdResult) }));
        }
示例#5
0
        public StatementOfAccountModel EntityToModel(StatementOfAccount entity)
        {
            StatementOfAccountModel model = new StatementOfAccountModel();

            if (entity != null)
            {
                model.StatementOfAccountId          = entity.StatementOfAccountId;
                model.StatementOfAccountNo          = entity.StatementOfAccountNo;
                model.StatementOfAccountDate        = entity.StatementOfAccountDate;
                model.StatementOfAccountPeriodFrom  = entity.StatementOfAccountPeriodFrom;
                model.StatementOfAccountPeriodUntil = entity.StatementOfAccountPeriodUntil;
                model.CompanyId  = entity.CompanyId;
                model.Company    = entity.Company;
                model.SoaDueDate = entity.SoaDueDate;
                model.CiNo       = entity.CiNo;
                model.Remarks    = entity.Remarks;
                //StatementOfAccountPrints = entity.StatementOfAccountPrints,
                model.CreatedBy    = entity.CreatedBy;
                model.CreatedDate  = entity.CreatedDate;
                model.ModifiedBy   = entity.ModifiedBy;
                model.ModifiedDate = entity.ModifiedDate;
                model.RecordStatus = entity.RecordStatus;
                if (model.CompanyId != null || model.CompanyId == Guid.Empty)
                {
                    model.CompanyAccountNoBarcode = BarcodeGenerator.GetBarcode(model.Company.AccountNo);
                }

                model.StatementOfAccountNoBarcode = BarcodeGenerator.GetBarcode(model.StatementOfAccountNo);
            }

            return(model);
        }
        public static void Run()
        {
            // ExStart:SetITF14SpecifyBorderType
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();

            // Instantiate barcode object and set CodeText & Barcode Symbology
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.ITF14, "00850006000227");

            // Set ITF14 Barcode Border Type
            generator.Parameters.Barcode.ITF.ItfBorderType = ITF14BorderType.FrameOut;

            // Set Font
            generator.Parameters.Barcode.CodeTextParameters.Font.FamilyName = "OCR B Std";
            generator.Parameters.Barcode.CodeTextParameters.Font.Size.Point = 8;

            // Set xDimension
            generator.Parameters.Barcode.XDimension.Millimeters = 0.495f;

            // Set Bars Height
            generator.Parameters.Barcode.BarHeight.Millimeters = 12.7f;

            // Specify space between characters
            generator.Parameters.Barcode.CodeTextParameters.Space.Millimeters = 0.5f;

            // Define resolution
            generator.Parameters.Resolution = 1200.0f;

            generator.Save(dataDir + "ITF14_Border_Type_Frame_out.png", BarCodeImageFormat.Png);
            // ExEnd:SetITF14SpecifyBorderType
        }
        public static void GenerateBarcodesFromInventory()
        {
            try
            {
                ClearDir(BarcodesDirectory);
            }
            catch (IOException e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                //string charset = "UTF-8"; // or "ISO-8859-1"
                BarcodeGenerator.createDMCodes(200, 200);
            }
            catch (WriterException e)
            {
                Console.WriteLine("Could not generate Barcode, WriterException :: " + e.Message);
            }
            catch (IOException e)
            {
                Console.WriteLine("Could not generate Barcode, IOException :: " + e.Message);
            }
        }
        public static void Run()
        {
            //ExStart:UseEncodeModeDatamatrixbarcode
            // The path to the documents directory.
            string dataDir       = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
            string gtin          = "898978777776665655";
            string uid           = "121212121212121212";
            string batch         = "GH768";
            string expDate       = "150923";
            string textToEncode  = gtin + uid + batch + expDate; // Or  "(01)"+ gtin + "(..)"+ uid + ...
            string textToDisplay = "GTIN:" + gtin + "\nUID:" + uid + "\nBatch:" + batch + "\nExp.Date:" + expDate;

            // Instantiate barcode object and set N order to avoid including all the names into the codetext, the property called "Display2DText" should be used.
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DataMatrix, "textToEncode");

            generator.Parameters.Barcode.CodeTextParameters.TwoDDisplayText = textToDisplay;
            generator.Parameters.Barcode.CodeTextParameters.Location        = CodeLocation.Below;

            // Builder.CodeTextSpace = 0; // Not recommended small space

            // Save the Barcode image
            generator.Save(dataDir + "codetextRightDisplay_out.png", BarCodeImageFormat.Png);
            //ExEnd:UseEncodeModeDatamatrixbarcode
            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir + "codetextRightDisplay_out.png");
        }
示例#9
0
        public static void Run()
        {
            // ExStart:AddingBarcodeImageToExcelWorksheet
            // For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_TechnicalArticles();

            // Instantiate linear barcode object, Set the Code text and symbology type for the barcode
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128, "1234567");

            // Creating memory stream and Saving barcode image to memory stream
            System.IO.Stream ms = new System.IO.MemoryStream();
            generator.Save(ms, BarCodeImageFormat.Bmp);

            // Instantiate Excel class that represents an excel file
            Workbook excel1 = new Workbook();

            // Add the barcode image into the pictures collection of the first worksheet of the excel file in the form of a MemoryStream, ms with upper left row=5 and
            // Upper left column=5 and Save the excel file
            excel1.Worksheets[0].Pictures.Add(5, 5, ms);
            excel1.Save(dataDir + "MyFile_out.xls");
            // ExEnd:AddingBarcodeImageToExcelWorksheet
            Console.WriteLine(Environment.NewLine + "Adding Barcode Image To Excel Worksheet Finished.");
        }
        public static void Run()
        {
            // ExStart:WideNarrowRatio
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodes();

            // Instantiate linear barcode object
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code39Standard, "1234567");

            // Set the wide to narrow ratio for the barcode
            generator.Parameters.Barcode.WideNarrowRatio = 3.0f;

            // Save the image to your system and set its image format to Jpeg
            generator.Save(dataDir + "barcode_ratio_3_out.jpg", BarCodeImageFormat.Jpeg);

            // Set the wide to narrow ratio for the barcode
            generator.Parameters.Barcode.WideNarrowRatio = 5.0f;

            // Save the image to your system and set its image format to Jpeg
            generator.Save(dataDir + "barcode_ratio_5_out.jpg", BarCodeImageFormat.Jpeg);

            // Set the wide to narrow ratio for the barcode
            generator.Parameters.Barcode.WideNarrowRatio = 7.0f;

            // Save the image to your system and set its image format to Jpeg
            generator.Save(dataDir + "barcode_ratio_7_out.jpg", BarCodeImageFormat.Jpeg);

            // Set the wide to narrow ratio for the barcode
            generator.Parameters.Barcode.WideNarrowRatio = 9.0f;

            // Save the image to your system and set its image format to Jpeg
            generator.Save(dataDir + "code39-wide-narrow-ratio_out.jpg", BarCodeImageFormat.Jpeg);
            // ExEnd:WideNarrowRatio
        }
        public static void Run()
        {
            try
            {
                // ExStart:CreateAndSetSizeForImageWithBarcode
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageBarCodes();

                // Generate the barcode and set code text, symbology type
                BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, "One thing 2 thing");

                // Set the code text location,  graphics unit and margins
                generator.Parameters.Barcode.CodeTextParameters.Location = CodeLocation.None;
                generator.Parameters.Barcode.Padding.Bottom.Pixels       = 0;
                generator.Parameters.Barcode.Padding.Top.Pixels          = 0;
                generator.Parameters.Barcode.Padding.Left.Pixels         = 0;
                generator.Parameters.Barcode.Padding.Right.Pixels        = 0;

                // Get Bitmap with exact barcode only
                Bitmap bmp = generator.GenerateBarCodeImage();

                bmp.Save(dataDir + "CreateAndSetSizeForImageWithBarcode_out.Png");
                // ExEnd:CreateAndSetSizeForImageWithBarcode
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            //ExStart:FNC1SecondPositionInExtendedMode
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();

            // Create codetext
            QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();

            lTextBuilder.AddFNC1SecondPosition("12");
            lTextBuilder.AddPlainCodetext("TRUE3456");

            // Generate codetext
            string lCodetext = lTextBuilder.GetExtendedCodetext();

            // Instantiate barcode object and Set its CodeText, encoding mode, error correction level,  display text and Symbology
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, lCodetext);

            generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.ExtendedCodetext;
            generator.Parameters.Barcode.QR.QrErrorLevel = QRErrorLevel.LevelL;
            generator.Parameters.Barcode.CodeTextParameters.TwoDDisplayText = "My Text";

            // Get barcode image Bitmap and Save QR code
            Bitmap lBmp = generator.GenerateBarCodeImage();

            lBmp.Save(dataDir + "FNC1SecondPositionInExtendedMode_out.bmp", ImageFormat.Bmp);
            //ExEnd:FNC1SecondPositionInExtendedMode
            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir + "FNC1SecondPositionInExtendedMode_out.bmp");
        }
        public static void Run()
        {
            // ExStart:ManageXYDimension
            // The path to the documents directory.
            string dataDir    = RunExamples.GetDataDir_ManageBarCodes();
            string dstCode128 = dataDir + "code128-YDimensionChanged_out.jpg";

            // Instantiate barcode object and set CodeText & Barcode Symbology
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128, "1234567");

            // Save the image to your system and set its image format to Jpeg
            generator.Save(dstCode128, BarCodeImageFormat.Jpeg);

            // Set the X-Dimension for the bars of the barcode
            generator.Parameters.Barcode.XDimension.Millimeters = 0.5f;

            // Save the image to your system and set its image format to Jpeg
            generator.Save(dstCode128, BarCodeImageFormat.Jpeg);

            // Instantiate barcode object and set differnt barcode properties
            using (BarcodeGenerator generator1 = new BarcodeGenerator(EncodeTypes.Pdf417, "1234567"))
            {
                generator1.Parameters.Barcode.BarCodeHeight.Millimeters = 4;

                // Save the image to your system and set its image format to Jpeg
                generator1.Save(dataDir + "pdf417-YDimensionChanged_out.jpg", BarCodeImageFormat.Jpeg);
            }
            // ExEnd:ManageXYDimension
        }
示例#14
0
        public FileResult Index(string editor1, string codeText, string barcodeType)
        {
            // generate a barcode
            string barcodeImagePath       = Path.Combine("wwwroot/barcodes/", Guid.NewGuid() + ".png");
            SymbologyEncodeType type      = GetBarcodeSymbology(barcodeType);
            BarcodeGenerator    generator = new BarcodeGenerator(type, codeText);

            generator.Parameters.BackColor = System.Drawing.Color.Transparent;
            // set resolution of the barcode image
            generator.Parameters.Resolution = 200;
            // generate barcode
            generator.Save(barcodeImagePath, BarCodeImageFormat.Png);

            // create a unique file name for PDF
            string fileName = Guid.NewGuid() + ".pdf";

            // convert HTML text to stream
            byte[] byteArray = Encoding.UTF8.GetBytes(editor1);
            // generate PDF from the HTML
            MemoryStream    stream      = new MemoryStream(byteArray);
            HtmlLoadOptions options     = new HtmlLoadOptions();
            Document        pdfDocument = new Document(stream, options);

            // add barcode image to the generated PDF
            pdfDocument = InsertImage(pdfDocument, barcodeImagePath);

            // create memory stream for the PDF file
            Stream outputStream = new MemoryStream();

            // save PDF to output stream
            pdfDocument.Save(outputStream);

            // return generated PDF file
            return(File(outputStream, System.Net.Mime.MediaTypeNames.Application.Pdf, fileName));
        }
        private void GenerateBarCodes(object sender, RoutedEventArgs rea)
        {
            var worker = new BackgroundWorker();

            worker.DoWork += (send, ev) =>
            {
                try
                {
                    var saveFileDialog = new VistaFolderBrowserDialog();
                    if (saveFileDialog.ShowDialog() == true)
                    {
                        BarcodeGenerator.CreateDmCodes(saveFileDialog.SelectedPath, MasterDataSet, this);
                    }
                }
                catch (WriterException e)
                {
                    Console.WriteLine($@"Could not generate Barcode, WriterException :: {e.Message}");
                }
                catch (IOException e)
                {
                    Console.WriteLine($@"Could not generate Barcode, IOException :: {e.Message}");
                }
            };
            worker.RunWorkerAsync();
            worker.Dispose();
        }
示例#16
0
        /// <summary>
        /// Update SOA with SOANo
        /// Generate PDF and store to file system
        /// Finalized SOA are non-editable
        /// </summary>
        /// <param name="entity"></param>
        public StatementOfAccountModel Finalize(StatementOfAccountModel model)
        {
            Logs.AppLogs(LogPath, "SOA BL - Finalize");
            StatementOfAccount entity = base.GetById(model.StatementOfAccountId);

            if (entity != null && string.IsNullOrEmpty(entity.StatementOfAccountNo))
            {
                //entity.StatementOfAccountNoInt = GetNewSoaNo(entity.StatementOfAccountId);
                entity.ModifiedBy   = model.ModifiedBy;
                entity.ModifiedDate = DateTime.Now;
                try
                {
                    base.Edit(entity);
                    //model.StatementOfAccountNo = entity.StatementOfAccountNo;
                    model.StatementOfAccountNoBarcode = BarcodeGenerator.GetBarcode(model.StatementOfAccountNo);
                    model.ModifiedDate = entity.ModifiedDate;
                    Logs.AppLogs(LogPath, "SOA BL - Finalize", "Successfull");
                }
                catch (Exception ex)
                {
                    Logs.ErrorLogs(LogPath, "SOA BL - Finalize", ex.Message);
                }
            }
            return(model);
        }
示例#17
0
 private BoxBarcode()
     : base()
 {
     this.BarcodeEAN13   = BarcodeGenerator.GetBarCodeNumber();
     this.BarcodeGS1_128 = string.Empty;
     this.RFID           = string.Empty;
 }
        public static void Run()
        {
            //ExStart:MultiECIModeInExtendedMode
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();

            // Create codetext
            QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();

            lTextBuilder.AddECICodetext(ECIEncodings.Win1251, "Will");
            lTextBuilder.AddECICodetext(ECIEncodings.UTF8, "Right");
            lTextBuilder.AddECICodetext(ECIEncodings.UTF16BE, "Power");
            lTextBuilder.AddPlainCodetext(@"t\e\\st");

            // Generate codetext
            string lCodetext = lTextBuilder.GetExtendedCodetext();

            // Initialize a BarcodeGenerator  class object, Set CodeText, Symbology, Encoding mode, correction level and display text
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, lCodetext);

            generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.ExtendedCodetext;
            generator.Parameters.Barcode.QR.QrErrorLevel = QRErrorLevel.LevelL;
            generator.CodeText = lCodetext;
            generator.Parameters.Barcode.CodeTextParameters.TwoDDisplayText = "My Text";

            Bitmap lBmp = generator.GenerateBarCodeImage();

            lBmp.Save(dataDir + "MultiECIModeInExtendedMode_out.bmp", ImageFormat.Bmp);
            //ExEnd:MultiECIModeInExtendedMode
            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir + "MultiECIModeInExtendedMode_out.bmp");
        }
        public string Generate(int width, int height, string message)
        {
            string targetFilePath = _filePath + "_" + _barcodeType.ToString();
            BarcodeImageConfiguration imageConfiguration = new BarcodeImageConfiguration(width, height, targetFilePath, BarcodeImageFormat.Jpeg);

            BarcodeGenerator.GenerateImage(message, ConvertType(_barcodeType), imageConfiguration);

            return(targetFilePath + ".jpg");
        }
示例#20
0
        private GraphicCodes()
            : base()
        {
            this.Boxes = new HashSet <Box>();

            this.BarcodeEAN13   = BarcodeGenerator.GetBarCodeNumber();
            this.BarcodeGS1_128 = string.Empty;
            this.RFID           = string.Empty;
        }
        public static void Run()
        {
            // ExStart:GenerateMultipleBarcodesOnSingleImage
            // For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_TechnicalArticles();

            Dictionary <string, BaseEncodeType> collection = new Dictionary <string, BaseEncodeType>();

            collection.Add("ONE123", EncodeTypes.Code39Standard);
            collection.Add("Process Collection", EncodeTypes.DataMatrix);
            collection.Add("Dictionary Collection", EncodeTypes.QR);
            collection.Add("X06712AT", EncodeTypes.Code128);
            collection.Add("979026000043", EncodeTypes.EAN13);
            collection.Add("Aztec BarCode", EncodeTypes.Aztec);

            List <Bitmap> images = new List <Bitmap>();

            foreach (KeyValuePair <string, BaseEncodeType> pair in collection)
            {
                BarcodeGenerator builder = new BarcodeGenerator(pair.Value, pair.Key);
                images.Add(builder.GenerateBarCodeImage());
            }

            int maxWidth  = int.MinValue;
            int sumHeight = 0;

            foreach (Bitmap bmp in images)
            {
                sumHeight += bmp.Height;
                if (maxWidth < bmp.Width)
                {
                    maxWidth = bmp.Width;
                }
            }

            const int offset       = 10;
            Bitmap    resultBitmap = new Bitmap(maxWidth + offset * 2, sumHeight + offset * images.Count);

            using (Graphics g = Graphics.FromImage(resultBitmap))
            {
                g.Clear(Color.White);

                int yPosition = offset;
                for (int i = 0; i < images.Count; ++i)
                {
                    Bitmap currentBitmap = images[i];
                    g.DrawImage(currentBitmap, offset, yPosition);
                    yPosition += currentBitmap.Height + offset;
                }
            }

            resultBitmap.Save(dataDir + "barcodes_out.png", ImageFormat.Png);
            // ExEnd:GenerateMultipleBarcodesOnSingleImage
            Console.WriteLine(Environment.NewLine + "Generating Multiple Barcodes On A Single Image Finished.");
        }
 public static void ImplementUpcaGs1DatabarCouponForNewBarcode()
 {
     //ExStart: ImplementUpcaGs1DatabarCouponForNewBarcode
     using (BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.UpcaGs1DatabarCoupon))
     {
         generator.Save(dataDir + "UpcaGs1DatabarCoupon.png");
     }
     //ExEnd: ImplementUpcaGs1DatabarCouponForNewBarcode
     Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir + "UpcaGs1DatabarCoupon.png");
 }
        public string Generate(int width, int height, string message)
        {
            string targetFilePath = _filePath + "_" + _barcodeType.ToString();
            BarcodeImageConfiguration imageConfiguration = new BarcodeImageConfiguration(width, height, targetFilePath, BarcodeImageFormat.Jpeg);
            QrConfiguration           qrConfiguration    = new QrConfiguration(ConvertQrMode(_qrModelType), ConvertEccLevel(_eccLevel), _version);

            BarcodeGenerator.GenerateImage(message, qrConfiguration, imageConfiguration);

            return(targetFilePath + ".jpg");
        }
示例#24
0
        private void PrintBarcode()
        {
            var br = new BarcodeGenerator();

            var barcodeImage = br.DrawBarcode(lblId.Text.ToString().PadLeft(7, '0'));

            var dlg = new frmPrintBarcode(barcodeImage, lblName.Text, lblAssetTag.Text);

            dlg.ShowDialog();
        }
示例#25
0
        public static void Run()
        {
            // ExStart:EnableImageBorder
            // For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET

            // Instantiate barcode object and Enable border to be shown in the barcode
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code93Standard);

            generator.Parameters.Border.Visible = true;
            // ExEnd:EnableImageBorder
        }
        public static void ImportBarcodeFromXML(string dataDir)
        {
            // ExStart:ImportBarcodeFromXML
            string xmlFile = dataDir + "barcode.xml";
            // Instantiate barcode object and set CodeText & Barcode Symbology
            BarcodeGenerator generator = BarcodeGenerator.ImportFromXml(xmlFile);

            generator.Save(dataDir + "barcode_xml_out.jpg", BarCodeImageFormat.Jpeg);
            // ExEnd:ImportBarcodeFromXML
            Console.WriteLine(Environment.NewLine + "Imported barcode saved at " + dataDir);
        }
        public static void Run()
        {
            //ExStart:SetBorderStyle
            // For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET

            // Instantiate barcode object and Set border style to solid
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code93Standard);

            generator.Parameters.Border.DashStyle = BorderDashStyle.Solid;
            //ExEnd:SetBorderStyle
        }
示例#28
0
        public static void Run()
        {
            // ExStart:BorderWidth
            // For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET

            // Instantiate barcode object and Set border width
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code93Standard);

            generator.Parameters.Border.Width.Millimeters = 0.5f;
            // ExEnd:BorderWidth
        }
        public static void Run()
        {
            // ExStart:CreateCode128Barcode
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodes();

            // Instantiate barcode object and set CodeText & Barcode Symbology
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128, "1234");

            generator.Save(dataDir + "Code128-customized_out.png");
            // ExEnd:CreateCode128Barcode
        }
        public static void Run()
        {
            // ExStart:CreatePDF417Barcode
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodes();

            // Instantiate BarcodeGenerator  object Set the Code text & SymbologyType for the barcode
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, "1234567890");

            generator.Save(dataDir + "pdf417-barcode_out.jpg", BarCodeImageFormat.Jpeg);
            // ExEnd:CreatePDF417Barcode
        }