public static void xPrint(int printCount, bool isHighResolution) { if (doc.Printer.IsPrinterOnline(_printer)) { var mediaID = doc.GetMediaId(); var mediaName = doc.GetMediaName(); for (int i = 0; i < printCount; i++) { doc.DoPrint(isHighResolution ? PrintOptionConstants.bpoHighResolution : PrintOptionConstants.bpoAutoCut, "0"); } return; } throw new Exception("No supported printer detected."); }