如何使用LocalPrintServer瞄准特定的打印机 [英] How do I use LocalPrintServer to target a specific printer

查看:1458
本文介绍了如何使用LocalPrintServer瞄准特定的打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下这个问题:的我如何从一个打印机队列检索的作业列表或号码?

我仍然停留在如何定位的特定的打印机这是我目前只使用LocalPrintServer类知道这个名字。该应用程序应该是一次打印几台机器和所有printspoolers需要单独监控。任何人都可以向我提供的代码片段显示了如何可以使用打印机的唯一名称实例化一个LocalPrintServer对象?

I'm still stuck on how to target a specific printer of which I currently only know the name using the LocalPrintServer class. The application is supposed to print to several machines at once and all printspoolers need to be monitored separately. Can anyone provide me with a code snippet that shows how I can instantiate a LocalPrintServer object using only the name of the printer?

在此先感谢!

编辑:溶液添加的代码片段:

Added code fragment of solution:

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;
}

这是不是很难毕竟!

推荐答案

尝试LocalPrintServer.GetPrintQueue指定的打印机名称。

Try the LocalPrintServer.GetPrintQueue specifying the printer name.

这篇关于如何使用LocalPrintServer瞄准特定的打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆