从网页(用 ASP.NET/VB 开发)打印报告(水晶报告),而不将其定向为 PDF
我使用 Visual Studio 2008 和 SQL Server 2000 作为后端,我们用于公司报告的报告软件是 Crystal Report 9 或 Crystal Report 7。
在(ReportViewer.aspx)页面,我将Crystal Report Viewer控件的打印模式属性设置为PDF,因为只有两个特性PDF 和 ActixeX
那么问题来了,如果用户单击 ReportViewer.aspx 的打印按钮![在此处输入图像描述][1]页面,它将定向到打印报告页面,该页面询问用户他/她想要打印的页面范围;![在此处输入图像描述][2] 然后它会自动下载用户想要打印的报告的 pdf 副本,然后用户应该打开下载的 pdf 文件并从那里打印。![输入图像描述这里][3]
这绝对是一个非常漫长的过程,用户(公司员工)以及经理甚至我都不喜欢它,我尝试用谷歌搜索它,这可能是我对该领域的了解很少,所以我发现了这个东西这是指 Visual Studio 2005 而不是 2008
- ' - ' - ' 使用 ActiveX 控件打印 ' - ' - '-
在最新版本的 Crystal Reports 中,您可以使用新的打印模式指定打印模式CrystalReportViewer.PrintMode 属性。它包含两种枚举类型:ActiveX 和 PDF。
When the property is set to PrintMode.PDF, the report is exported as a PDF on the Web server, and then streamed to the browser. The user is given the option to print directly to the printer. This option is cross-platform compatible.
When the property is set to PrintMode.ActiveX, an ActiveX printing control allows users to print the report directly to their local printer.
Note In Crystal Reports for Visual Studio 2005, the ActiveX print control is not installed on the local machine, in order to meet Microsoft security requirements. Instead, it must be accessed as a .cab file from an external URL. The PrintControl.cab file can be downloaded from the Business Objects tech support Web Site, at which point you can place the cab file in a web server virtual directory for URL access.
To make the cab file visible to your Crystal Reports for Visual Studio 2005 Web Site, add the following xml to your Web Site's web.config file:
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="printControl" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" />
</sectionGroup>
</sectionGroup>
</configSections>
<businessObjects>
<crystalReports>
<printControl>
<add key="url" value="http://myserver/PrintControl.cab" />
</printControl>
</crystalReports>
</businessObjects>
Note Only Internet Explorer supports ActiveX controls. Printing from a non-Internet Explorer client (FireFox, Safari, Mozilla, and others) reverts to the PDF export dialog.
' - ' - ' - ' - ' -
如果有人可以帮助我,我将非常感激,点击报告查看器的打印按钮后打印报告,而不是将其定向到 pdf,这是一个很长的路要走。
I'm using Visual Studio 2008 and SQL Server 2000 as a back end and the reporting software we do use for the company's reports is either Crystal Report 9 or Crystal Report 7.
The (ReportViewer.aspx) page, I've set the Print Mode property of the Crystal Report Viewer Control to PDF as there are only two properties PDF and ActixeX
So here comes the problem, if the user clicks the print button of the ReportViewer.aspx ![enter image description here][1]Page it directs to a PRINT THE REPORT page which asks the user the page range he/she wants to prints;![enter image description here][2] Then it'll automatically download a pdf copy of the report the user wanted to print, and the user should then open the downloaded pdf file and print it from there.![enter image description here][3]
This is absolutely a very long process and the users (Company Staff) as well the managers and even me aren't fond of it, I tried to google it and its may be my little knowledge of the field, so I found out this stuff which is referring to Visual Studio 2005 and not 2008
- ' - ' - ' Printing using the ActiveX control ' - ' - '-
In recent versions of Crystal Reports, you can specify the print mode using the new CrystalReportViewer.PrintMode property. It contains two enumerated types: ActiveX, and PDF.
When the property is set to PrintMode.PDF, the report is exported as a PDF on the Web server, and then streamed to the browser. The user is given the option to print directly to the printer. This option is cross-platform compatible.
When the property is set to PrintMode.ActiveX, an ActiveX printing control allows users to print the report directly to their local printer.
Note In Crystal Reports for Visual Studio 2005, the ActiveX print control is not installed on the local machine, in order to meet Microsoft security requirements. Instead, it must be accessed as a .cab file from an external URL. The PrintControl.cab file can be downloaded from the Business Objects tech support Web Site, at which point you can place the cab file in a web server virtual directory for URL access.
To make the cab file visible to your Crystal Reports for Visual Studio 2005 Web Site, add the following xml to your Web Site's web.config file:
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="printControl" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" />
</sectionGroup>
</sectionGroup>
</configSections>
<businessObjects>
<crystalReports>
<printControl>
<add key="url" value="http://myserver/PrintControl.cab" />
</printControl>
</crystalReports>
</businessObjects>
Note Only Internet Explorer supports ActiveX controls. Printing from a non-Internet Explorer client (FireFox, Safari, Mozilla, and others) reverts to the PDF export dialog.
' - ' - ' - ' - ' -
I'd really appreciate if any one can help me, print the report after hitting the print button of the report viewer instead of directing it to pdf which is a very long way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用ActiveX,当您按下打印按钮时,它将自动打印,但您需要在用户PC中安装Crystal Control
If you use ActiveX when you will press the print button it will print automatically but you need to install Crystal Control in Users PC
查看 Report Runner Batch 和 Report Runner Event Server。它们是为轻松处理此任务而创建的商业产品。除了打印之外,您还可以做更多的事情。
http://www.reportrunner.com
Check out Report Runner Batch and Report Runner Event Server. They are commercial products created to handle this task with ease. You'll be able to do more than print, too.
http://www.reportrunner.com
隐藏水晶工具栏中的打印按钮,然后,
放置一个您自己的按钮,然后添加以下代码:
将报表的指定页面打印到使用
PrintOptions.PrinterName 属性
选择的打印机。如果未选择打印机,则将使用报告中指定的默认打印机。Hide the print button in the crystal toolbar and then,
put a your own button and then this code:
Prints the specified pages of the report to the printer selected using the
PrintOptions.PrinterName property
. If no printer is selected, the default printer specified in the report will be used.