![](/img/trans.png)
[英]How to skip the dialog of printing in printDocument.print() and print page directly?
[英]PrintDocument.Print is slow unless user is logged in to the printing computer
我在服务器“ A”(SA)上托管了一个Web应用程序,在服务器“ B”(SB)上托管了一个用于打印的Web服务。 SA创建需要打印的图像并将其发送给SB。 这样做时,打印速度很慢,大约十五秒钟。 但是,如果我以用户身份从SA托管的应用程序的webconfig中使用远程桌面登录SB,则它将在不到两秒钟的时间内打印出来。 当我登录时,似乎SB正在启动某些东西,这使其打印速度更快。 知道这可能是什么,并且即使没有登录也有办法使我保持打印速度很快吗?
编辑:正在打印的图像大小约为20 KB。
以下是SB上托管的服务的代码:
public void PrintImage(Stream printImage, string printServer, string printer)
{
string printerName = String.Format(@"\\{0}\{1}", printServer, printer);
Image image = Image.FromStream(printImage);
PrintDocument printDocument = new PrintDocument();
PrinterSettings settings = new PrinterSettings();
settings.PrinterName = printerName;
printDocument.PrinterSettings = settings;
printDocument.PrintPage += (s, e) =>
{
e.Graphics.DrawImage(image, 0, 0);
};
printDocument.Print();
}
感谢您抽出宝贵时间阅读本:)
我们发现,如果我们在SB上创建打印机映射,则无需远程桌面连接即可执行相同的速度。
对我们来说,只要在IIS中打开“ Load User Profile
”选项,打印速度就会很快。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.