从 IIS 中的应用程序打印到服务器上的网络打印机 [英] Printing from an application in IIS to a networked printer on server

查看:28
本文介绍了从 IIS 中的应用程序打印到服务器上的网络打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一行代码可以作为服务的一部分在本地运行,并且运行良好.

I have a line of code that I can run locally as part of a service that works perfectly fine.

sReportPath = objCrystalUtils.ExportReportToPDF("Report Name", iReportInfoID)

此代码作为服务的一部分运行,当我通过提供数据对其进行单元测试时,它最终会构建报告并打印出来.

This code is run as a part of a service, and when I unit test it by feeding it data, it ultimately builds the report and prints it.

当我通过 ajax 调用在 .ashx 中运行完全相同的代码时.报告已生成(我可以看到正在磁盘上创建的 pdf 文件),但没有进行打印.

When I run the exact same piece of code inside an .ashx from an ajax call. The reports are generated (I can see the pdf files being created on disk) but the printing is not happening.

 oRpt.PrintToPrinter(objReport.DefaultAutoPrint, True, 0, 0)

在这两种情况下,都使用相同的代码来打印报告.(objReport.DefaultAutoPrint = 0 在这两种情况下)

In both scenarios the same code is used to print the report. (objReport.DefaultAutoPrint = 0 in both cases)

我唯一的想法是调用此方法的代码的位置与账单本身的位置不同.

My only thought is that the location of the code that is calling this method is in a different spot relative to the location of the bills themselves.

我要打印的打印机是安装在我的机器上的网络打印机,并且我运行的是 Windows 7 IIS 6.1

The printer that I'm trying to print to is a network printer intalled on my machine, and I'm running Windows 7 IIS 6.1

有什么想法吗?

这是一个想法...如果我在本地运行一个单元测试,而我通过一个通过 IIS 运行的 Web 应用程序运行另一个,用户 ID 和用户对默认打印机的访问权限是否存在差异?

Here is a thought... if I'm running one as a unit test locally and im running the other through a web app that is running via IIS, is there a difference in user id and user access to the default printer?

所以我将我的本地 ASP、IUSR 和 SYSTEM 用户添加到打印机安全性中,并允许他们打印......没有骰子.所以我检查了每个用户,它被设置为访问并且没有用户被拒绝......所以我认为这有点扼杀了这种推理.

So I added my local ASP, IUSR and SYSTEM users to the printer security and allowed them to print... no dice. So I checked the EVERYONE user and it is set to access and NO users are denied... so I think that kinda kills that line of reasoning.

我更改了这篇文章的名称,因为我不再认为该问题与 ajax 相关,因为如果我尝试在回帖后面的代码中执行相同的过程而不是从 ajax 调用中运行它,我仍然会得到相同的结果问题.

I changed the name of this post since I no longer think that the issue is ajax related since If I try to do the same process in code bebehind from a post back instead of running it from an ajax call i still get the same problem.

推荐答案

Patrick,对我来说,这是水晶报表的一个已知问题,通过 IIS 从正在运行的应用程序打印某个报表.

Patrick, for me it is a known issue of crystal reports, printing a certain report from a running application via IIS.

我之前遇到过同样的问题,在我们搜索该问题后,我们得到了以下问题;

I got the same issue before, and upon our search for that issue, we got the following;

Report to be generated, exported, and then to be downloaded to client machine,  
so user can print it locally (say, report will be exported as PDf file, 
user can use print option of PDF reader).

这篇关于从 IIS 中的应用程序打印到服务器上的网络打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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