问题是,如果我从打印对话框中选择黑白打印,它总是返回彩色打印。
我尝试过
OutputColor
或
PrintTicket
中的
PrintCapabilities
,但无论我从打印对话框中选择黑白,两者都会返回彩色打印。 这是我的代码,我如何从中获取它
PrintSystemJobInfo
:
Form1 f = form as Form1;
PrintSystemJobInfo job = e.JobInfo;
if (job == null) return;
f.UpdatePrintInfoList(job, e);
if (job.IsSpooling)
{
job.Pause();
pausedJobs.Add(new PausedJob(e.JobID));
}
else if (job.IsPaused)
{
PrintQueue pq = job.HostingPrintQueue;
pq.Refresh();
PrintJobSettings pjs = pq.CurrentJobSettings;
PrintTicket pt = pq.UserPrintTicket;
PrintCapabilities pc = pq.GetPrintCapabilities();
string outputColor = string.Empty;
if (pc.OutputColorCapability.Contains(OutputColor.Color))
{
outputColor = "Color";
}
else if (pc.OutputColorCapability.Contains(OutputColor.Grayscale))
{
outputColor = "Grayscale";
}
else if (pc.OutputColorCapability.Contains(OutputColor.Monochrome))
{
outputColor = "Monochrome";
}
else
{
outputColor = "Unknown";
}
PrinterSettings ps = new();
ps.PrinterName = printer;
string jobDetails = string.Format(
"Job Status: {0}\n" +
"Printer: {1}\n" +
"No. of Pages: {2}\n" +
"Output Color (PrintTicket): {3}\n" +
"Output Color (PrintCapabilities): {4}\n" +
"\nWould you like to continue printing?",
"Paused",
printer,
job.NumberOfPages,
pt.OutputColor,
outputColor);
}
Chrome 正在将彩色或黑白数据渲染到 Windows 打印驱动程序。 Windows 打印驱动程序通常采用以下三种模式之一:
Print using system dialog...
链接。