1

我正在尝试使用 C# 禁用高级打印功能 (RawOnly)。我可以列出所有打印机:

foreach (string printer in PrinterSettings.InstalledPrinters)
{
    Console.WriteLine(printer);
}

我可以阅读 RawOnly 功能:

PrintQueueAttributes[] queueAttributes = { PrintQueueAttributes.RawOnly };
EnumeratedPrintQueueTypes[] enumerationFlags = { EnumeratedPrintQueueTypes.RawOnly };
LocalPrintServer printServer = new LocalPrintServer();
PrinterSettings settings = new PrinterSettings();
PrintQueueCollection printQueuesOnLocalServer = printServer.GetPrintQueues();
foreach (PrintQueue printer in printQueuesOnLocalServer)
{
     Console.WriteLine("\tThe printer " + printer.Name + "is Advanced Printing Features enabled" + printer.IsRawOnlyEnabled + "\n");
}
Console.WriteLine("Press enter to continue.");
Console.ReadLine();

但我不知道 Set RawOnly 功能很热门。你能帮我解决这个问题吗?谢谢你。

有关 EnumeratedPrintQueueTypes 的其他信息https://msdn.microsoft.com/en-us/library/system.printing.enumeratedprintqueuetypes(v=vs.110).aspx

有关 PrintQueueAttributes 的其他信息 https://msdn.microsoft.com/en-us/library/system.printing.printqueueattributes(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet -1

PS 我不想使用 Win32_Printer 类,因为它有一些问题。

4

0 回答 0