Esempio n. 1
0
        public void PrintPages(System.Drawing.Printing.PrintRange range)
        {
            IPrinterService printer;

            if (isWindows)
            {
                printer = new WinPrinterService(document, printDocument.PrinterSettings.PrinterName);
            }
            else
            {
                printer = new PrinterService(document, printDocument.PrinterSettings.PrinterName);
            }
            switch (range)
            {
            case System.Drawing.Printing.PrintRange.AllPages:
                printer.PrintAll();
                break;

            case System.Drawing.Printing.PrintRange.CurrentPage:
                printer.PrintRange(printPreviewControl1.StartPage, printPreviewControl1.StartPage);
                break;

            case System.Drawing.Printing.PrintRange.Selection:
                break;

            case System.Drawing.Printing.PrintRange.SomePages:
                printer.PrintRange(printDocument.PrinterSettings.FromPage, printDocument.PrinterSettings.ToPage);
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
        public static PrintSelection ToEto(this sdp.PrintRange value)
        {
            switch (value)
            {
            case sdp.PrintRange.AllPages:
                return(PrintSelection.AllPages);

            case sdp.PrintRange.SomePages:
                return(PrintSelection.SelectedPages);

            case sdp.PrintRange.Selection:
                return(PrintSelection.Selection);

            default:
                throw new NotSupportedException();
            }
        }