【问题标题】:How to make printdocument class work after deploying in iis?在 iis 中部署后如何使 printdocument 类工作?
【发布时间】:2013-04-22 03:43:03
【问题描述】:

我在 asp.net 中有一个打印账单的项目。我已经让我自己的打印类继承表单 PrintDocument 表单 System.Drawing.Printing 并且它在 Visual Studio 开发服务器中运行良好。但是在 IIS 中部署后它不起作用。 经过大量研究后,我发现 System.Drawing.Printing 不适用于 asp.net。 有什么办法可以使用同一个类进行一些调整来打印......或者 可能的选项是什么(除了javascript)? 打印将在本身托管 IIS 服务器的本地计算机上完成。

【问题讨论】:

    标签: asp.net iis printdocument


    【解决方案1】:

    我相信您可以使用 System.Printing.PrintQueue 做到这一点。

    System.Printing.PrintServer("PrintServerName").PrintQueueCollection 将为您提供所有可用的PrintQueues。这是来自 MSDN 的一些示例代码:

    // Create a PrintServer 
    // "theServer" must be a print server to which the user has full print access.
    PrintServer myPrintServer = new PrintServer(@"\\theServer");
    
    // List the print server's queues
    PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
    String printQueueNames = "My Print Queues:\n\n";
    foreach (PrintQueue pq in myPrintQueues)
    {
        printQueueNames += "\t" + pq.Name + "\n";
    }
    Console.WriteLine(printQueueNames);
    

    这是a good referencePrintQueues 背后的概念

    【讨论】:

    猜你喜欢
    • 2014-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-13
    • 1970-01-01
    • 2020-09-23
    相关资源
    最近更新 更多