Quantcast
Channel: SCN : Document List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 52

Crystal Reports Client Side Printing without the Viewer

$
0
0

Purpose

 

This document contains instructions that allow the Crystal Reports in a web application to print client-side without the viewer being visible to the end user.

 

Overview

 

 

 

Introduction

 

In many cases, a web application will have the requirement of client side printing of a Crystal Report. Problem with direct print to a client printer is that by definition there will be no user intervention. IE (or any other browser) does not allow this as that is a major security treat. Therefore Microsoft raised security restrictions and client-side printing is either not permitted or highly restricted. To achieve client-side printing where all the pages of any document can be printed to the  client, some kind of client-side code needs to be executed.  Adobe Acrobat and Microsoft Word achieve printing entire documents by supplying a client side control that can access the entire document and print it. This document explains how to work around these restrictions when using Crystal Reports. The solution involves shrinking the Crystal Reports web viewer to the size of the viewer print button. In this way, we satisfy the requirement of client-side code. All the user needs to do, is click the print button, select the applicable printer and print the report, without ever viewing it.

 

The Solution

 

The solution uses Visual Studio 2010 and SAP Crystal Reports, developer version for Microsoft Visual Studio (2010 / 2012). The following steps will display only a print button on the web form:

 

1.  Add the Crystal Reports viewer to a web form:

 

1.png

 

2.  You should now see the viewer added to the form. In the CrystalReportViewer Tasks select a report. You can choose a new report or browse to an

     existing report. Neither will be used once we are done shrinking the viewer:

 

2.png

 

3.  Choose your report:

 

3.png

 

4.  Set the BestFit of the viewer property to false:

 

4.png

 

5.  Set the Viewer Height property to 50 px and the Width property to 40px:

 

5.png

 

6.  Set the following viewer properties to False:

 

6.png

  The viewer should now be sized down to the size of the print button:

 

7.png

 

8.  View the page in your application. It should look like the following:

 

8.png

9.  In your application, add code to load a report:

 

9.png

10.  Run the application. Click the Print button and the following dialog will be presented:

 

10.png

 

The report will print to the user selected printer attached to their computer (client side print).

 

 

 

Related Content

Related Documents

 

Troubleshooting issues related to PrintToPrinter() when used in .NET applications for printing Crystal Reports

Server side printing with Crystal .NET SDK

 

 

Related Notes / KBAs

 

KBA 1605739 - Blank 'Crystal Reports ActiveX Print' window when printing from a VS .NET Web application

KBA 1302913 - custom paper size can not be retained at a client machine via ASP.NET application

KBA 1561762 - "A Communication error has occurred. Printing will be stopped." appears when users try to print a Crystal report


Viewing all articles
Browse latest Browse all 52

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>