打印到Microsoft打印到PDF不能在托管计算机上工作? [英] Printing to Microsoft print to PDF not working on hosted machine?

查看:124
本文介绍了打印到Microsoft打印到PDF不能在托管计算机上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我试图通过将打印机名称传递给PrintDocuemt()对象,从服务器端直接打印到打印机。从localhost运行时,下面的代码工作正常,但是当从IIS上的托管应用程序运行时,代码会被卡住。我正在尝试将文档打印到pdf使用,微软默认打印机微软打印到PDF在Windows 10 /



我尝试过:



Hi,

I am trying to print directly to the printer from server side by passing printer name to PrintDocuemt() object. Below codes works fine when running from localhost but gets stucked when running from hosted application on IIS. I am trying to print document to pdf using, microsofts default printer "Microsoft Print to PDF" in windows 10/

What I have tried:

var doc = new PrintDocument();
               doc.PrintPage += new PrintPageEventHandler(ProvideContent);
               if (TempData.Peek("PrinterName") != null && TempData.Peek("PrinterName").ToString() != "")
               {
                   doc.PrinterSettings.PrinterName = TempData.Peek("PrinterName").ToString();
               }

               doc.Print();
               doc.Dispose();

推荐答案

服务器是否安装了PDF打印驱动程序?如果它没有,那么不,那不会起作用......
Does the server have the PDF print driver installed? If its doesn't, then no, that's not going to work ...


这篇关于打印到Microsoft打印到PDF不能在托管计算机上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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