示例#1
0
 private void UpdateBarcodeOutputAmount()
 {
     if (NumberOfPages >= 0)
     {
         var generator = new BarcodePDFGenerator();
         generator.PageSize      = GetPaperSize();
         generator.BarcodeType   = GetBarcodeType();
         generator.NumberOfPages = 1;
         generator.IsDryRun      = true;
         NumberOfBarcodesOutput  = NumberOfPages * generator.GenerateBarcodes("");
     }
 }
示例#2
0
        private void GeneratePDFOfBarcodes()
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "PDF file (*.pdf)|*.pdf";
            saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            saveFileDialog.FileName         = "Inventory-Barcodes-" + DateTime.Now.ToString("yyyy-MM-dd-H-mm-ss");
            if (saveFileDialog.ShowDialog() == true)
            {
                var generator = new BarcodePDFGenerator();
                generator.PageSize      = GetPaperSize();
                generator.BarcodeType   = GetBarcodeType();
                generator.NumberOfPages = NumberOfPages;
                try
                {
                    generator.GenerateBarcodes(saveFileDialog.FileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Error generating PDF! Please make sure to close the PDF with the same name" +
                                    " if it is open in Adobe or other software before generating a PDF report.", "Error!", MessageBoxButton.OK);
                }
            }
        }