Beispiel #1
0
        public void PrintPreview()
        {
            if (!ValidateInput())
            {
                return;
            }

            ///setup page size
            PageSetupDialog pageDialog1 = new PageSetupDialog();

            SetSelection();

            LabelPrintDocument engine = new LabelPrintDocument(serienummers);

            engine.TitelFont     = Settings.Label.TitelFont.ToFont();
            engine.ItemFont      = Settings.Label.ItemFont.ToFont();
            engine.Product       = serienummers.Product;
            pageDialog1.Document = engine;

            //standaard printer instellen
            engine.PrinterSettings.PrinterName = Settings.Label.PrinterSettings.Printer;

            //standaard papier instellen
            SelectCustomPaper(engine, pageDialog1);

            PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog(); // instantiate new print preview dialog

            printPreviewDialog1.Document = engine;
            if (printPreviewDialog1.ShowDialog() == DialogResult.OK)
            {
                engine.Print();
            }
        }
        public override void Start(IWorkerParameters parameters)
        {
            var labelPrintParameters = new LabelPrintParameters(parameters);

            var labelPrintDocument = new LabelPrintDocument();

            labelPrintDocument.Print(labelPrintParameters);
        }
Beispiel #3
0
 private void SelectCustomPaper(LabelPrintDocument engine, PageSetupDialog pageDialog1)
 {
     for (int index = 0; index < engine.PrinterSettings.PaperSizes.Count; index++)
     {
         if (engine.PrinterSettings.PaperSizes[index].PaperName == Settings.Label.PrinterSettings.Paper)
         {
             PaperSize size = engine.PrinterSettings.PaperSizes[index];
             pageDialog1.PageSettings.PaperSize = size;
         }
     }
 }
Beispiel #4
0
        public void Print()
        {
            if (!ValidateInput())
            {
                return;
            }

            //setup page size
            PageSetupDialog pageDialog1 = new PageSetupDialog();

            SetSelection();

            LabelPrintDocument engine = new LabelPrintDocument(serienummers);

            engine.TitelFont     = Settings.Label.TitelFont.ToFont();
            engine.ItemFont      = Settings.Label.ItemFont.ToFont();
            engine.Product       = serienummers.Product;
            pageDialog1.Document = engine;

            //standaard printer instellen
            engine.PrinterSettings.PrinterName = Settings.Label.PrinterSettings.Printer;

            //eventueel standaard papier instellen
            SelectCustomPaper(engine, pageDialog1);

            printDialog1.Document              = engine;
            printDialog1.AllowSelection        = true;
            printDialog1.AllowSomePages        = true;
            printDialog1.Document.DocumentName = string.Format("Serienummer labels {0}", serienummers.Product);
            if (Settings.Label.PrinterSettings.AlwaysShowPrintDialog)
            {
                if (printDialog1.ShowDialog() == DialogResult.OK)
                {
                    engine.Print();
                }
            }
            else
            {
                engine.Print();
            }
        }