Пример #1
0
        public static List <string> GetPrintList()
        {
            PrinterSearcher p = new PrinterSearcher();

            PrinterSearcher.PrinterInfo[] printers = p.Search(PRINTER_ENUM.SHARED);

            List <string> printerNames = new List <string>();

            foreach (PrinterSearcher.PrinterInfo pi in printers)
            {
                printerNames.Add(pi.Name);
            }

            return(printerNames);
        }
Пример #2
0
        public static string GetLocalPrinter()
        {
            //whatthefuck("");
            //AvailablePrinters();
            ////GetDefaultPrinterName();
            ////PrinterHelper.GetPrinterList();
            //GetPrinters();
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_DEFAULT);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_CONNECTIONS);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_CONTAINER);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_EXPAND);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_FAVORITE);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_HIDE);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_ICON1);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_ICON2);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_ICON3);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_ICON4);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_ICON5);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_ICON6);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_ICON7);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_ICON8);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_ICONMASK);
            PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_LOCAL);
            //PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_NAME);
            PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_NETWORK);
            PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_REMOTE);
            PrinterHelper_1.GetPrinterList(PrinterEnumFlags.PRINTER_ENUM_SHARED);
            PrinterSearcher p = new PrinterSearcher();

            PrinterSearcher.PrinterInfo[] printers = p.Search(PRINTER_ENUM.SHARED);

            foreach (PrinterSearcher.PrinterInfo pi in printers)

            {
                Console.WriteLine("=====================================\n打印机名: {0}\n描叙:: {1}\n注释: {2}\n=====================================\n",

                                  pi.Name, pi.Description, pi.Comment);
            }
            foreach (string printerName in PrinterSettings.InstalledPrinters)
            {
                if (printerName.CompareTo("whatthefuck") == 0)
                {
                    return(printerName);
                }
            }

            return(@"\\10.2.0.141\FX DocuPrint M158 b");
        }