Skip to Content

Crystal Reports Client Side Printing without the Viewer

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:

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:

3.  Choose your report:

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

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

6.  Set the following viewer properties to False:

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

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

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

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

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

Tags: