Example #1
0
        public static void Print(int PrintCount = 1, bool isHighResolution = false)
        {
            string OnlinePrinter = "";

            foreach (object o in (object[])doc.Printer.GetInstalledPrinters())
            {
                if (doc.Printer.IsPrinterOnline(o.ToString()))
                {
                    OnlinePrinter = o.ToString();
                    break;
                }
            }

            if (string.IsNullOrWhiteSpace(OnlinePrinter))
            {
                throw new Exception("No supported printer detected.");
            }

            doc.SetPrinter(OnlinePrinter, true);

            for (int i = 0; i < PrintCount; i++)
            {
                doc.DoPrint(isHighResolution ? PrintOptionConstants.bpoHighResolution : PrintOptionConstants.bpoAutoCut, "0");
            }
        }