如何使用LocalPrintServer定位特定打印机?
|
提出以下问题:如何从打印机队列中检索作业列表或数量?
我仍然停留在如何使用特定打印机的目标上,我目前仅使用LocalPrintServer类知道其名称。该应用程序应该一次打印到多台机器,并且所有打印后台处理程序都需要分别进行监视。谁能为我提供一个代码片段,该代码片段显示如何仅使用打印机名称实例化LocalPrintServer对象?
提前致谢!
编辑:添加了解决方案的代码片段:
private int GetNumberOfPrintJobs()
{
LocalPrintServer server = new LocalPrintServer();
PrintQueueCollection queueCollection = server.GetPrintQueues();
PrintQueue printQueue = null;
foreach (PrintQueue pq in queueCollection)
{
if (pq.FullName == PrinterName) //PrinterName is a classmember
printQueue = pq;
}
int numberOfJobs = 0;
if (printQueue != null)
numberOfJobs = printQueue.NumberOfJobs;
return numberOfJobs;
}
毕竟这并不难!
没有找到相关结果
已邀请:
2 个回复
诧不达
车料
来自from4ѭ对象,也不一定包含在
中。 如果使用ѭ5(ѭ6),则会从用户角度获得已安装的所有打印机的列表。 如果您已经安装了远程打印机(在打印服务器上),则其中一些可能在远程计算机上。如果它是可通过IP访问的网络打印机,那么它将仍然是本地打印机:
要在远程服务器上检索打印队列,您需要执行以下操作:
是的,您需要自己解析。