How to Directly Print a Crystal Reports to Default Client Printer from ASP.NET without Preview or Printer Dialog

In this walkthrough, you'll learn how to directly print a Crystal Reports (RPT file) to the Default Client printer from an ASP.NET website without preview! In fact, you'll be able to print the RPT report to any installed printer at the client machine without displaying any Printer Dialog at all! And one important thing... it works with any browser on Windows OS like IE (6 or later), Chrome, Firefox, Opera & Safari!
Directly Print Crystal Reports to Default Client Printer from ASP.NET without Preview or Printer Dialog

The sample report is a Crystal Reports (RPT) designed to print a products list of the classic and famous MS Northwind Traders database. In a simple ASP.NET webpage, we provide all the needed code in C# and VB to print the rpt sample report file without previewing or displaying any printer dialog by using WebClientPrint for ASP.NET solution

By using WebClientPrint solution in your ASP.NET website, your users will be able to print the Crystal Reports RPT file to the Default client printer as well as to any other installed printer available at the client machine without displaying any print dialog.

Want to add client printing for IE, Firefox & Chrome to CrystalReportViewer? How to add Custom Printing options to ASP.NET Crystal Reports Viewer toolbar

- WebClientPrint 2.0 for ASP.NET (or greater)
- ASP.NET 3.5 (or greater)
- Visual Studio 2010 / VWD 2010 (or greater)
- SAP Crystal Reports for Visual Studio 2010
- jQuery 1.4.1 (or greater)

- WebClientPrint Processor 2.0 for Windows (WCPP) - Part of WebClientPrint Solution
- Adobe Reader

NOTE: In this guide we used VS 2010, ASP.NET 3.5 & SAP Crystal Reports for Visual Studio 2010 but the same code & concept can be applied to VS 2005/2008 and ASP.NET 2.0 as well as VS 2012 and ASP.NET 4.x with other Crystal Reports editions

Follow up these steps
- Download & install WebClientPrint for ASP.NET
- Open Visual Studio and create a new ASP.NET 3.5 Website naming it PrintCrystalReports
- Add a reference to Neodynamic.SDK.WebClientPrint.dll to your project
- Be sure that your website references CrystalDecisions.CrystalReports.Engine.dll and CrystalDecisions.Shared.dll
If they are missing, then please add both references to your project.
- Open your web.config file and add the following entries:

<add verb="*" path="wcp.axd" type="Neodynamic.SDK.Web.WebClientPrint, Neodynamic.SDK.WebClientPrint"/>
<add name="WCP" verb="*" path="wcp.axd" type="Neodynamic.SDK.Web.WebClientPrint, Neodynamic.SDK.WebClientPrint"/>

- Open the default.aspx page and paste the following markup. The task of this page is to try to detect the WCPP and ask the user to install it if it's missing.

<html xmlns="">
<head runat="server">

body{font: 13px 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;}

<%-- WCPP-detection meta tag for IE10 --%>
<%= Neodynamic.SDK.Web.WebClientPrint.GetWcppDetectionMetaTag() %>
<form id="form1" runat="server">
<div id="msgInProgress">
<div id="mySpinner" style="width:32px;height:32px"></div>
<br />
Detecting WCPP utility at client side...
<br />
Please wait a few seconds...
<br />
<div id="msgInstallWCPP" style="display:none;">
<h3>#1 Install WebClientPrint Processor (WCPP)!</h3>
<strong>WCPP is a native Windows app (without any dependencies!)</strong> that handles all print jobs
generated by the <strong>WebClientPrint ASP.NET component</strong> at the server side. The WCPP
is in charge of the whole printing process and can be
installed on Windows 98, 2000, Me, XP, Vista, Windows 7 and Windows 8 (Desk-mode). It can print to Serial Port RS232 (e.g. COM1),
Parallel Port (e.g. LPT1), your Windows-Installed Printers (USB) and Network/IP Ethernet printers.
The <strong>WCPP</strong> utility <strong>is digitally-signed with a Windows Authenticode</strong> issued by <a href="">DigiCert, Inc.</a>. <strong>Install WCPP only if the <u>Publisher is Neodynamic SRL</u></strong>, otherwise do not proceed. <br /><br />
<a href="" target="_blank">Download and Install WCPP from Neodynamic website</a><br />
<h3>#2 After installing WCPP...</h3>
<a href="PrintCrystalReports.aspx">You can go and test WebClientPrint for ASP.NET</a>


<%-- Add Reference to jQuery at Google CDN --%>
<script src=""></script>

<%-- Add Reference to spin.js (an animated spinner) --%>
<script src=""></script>

<script type="text/javascript">

var wcppPingDelay_ms = 10000;

function wcppDetectOnSuccess(){
<%-- WCPP utility is installed at the client side
redirect to WebClientPrint sample page --%>

<%-- get WCPP version --%>
var wcppVer = arguments[0];
if(wcppVer == "")
window.location.href = "PrintCrystalReports.aspx";
else //force to install WCPP v2.0

function wcppDetectOnFailure() {
<%-- It seems WCPP is not installed at the client side
ask the user to install it --%>

$(document).ready(function () {
<%-- Create the Spinner with options ( --%>
var spinner = new Spinner({
lines: 12,
length: 7,
width: 3,
radius: 10,
color: '#336699',
speed: 1,
trail: 60


<%-- WCPP detection script --%>
<%= Neodynamic.SDK.Web.WebClientPrint.CreateWcppDetectionScript() %>


- The Crystal Reports (RPT) we've created for this sample is a simple product list for MS Northwind Traders database and it has an XML data source. The report looks like the following figure.
Sample Crystal Reports (RPT) featuring Northwind Traders products list

- Download and copy both MyProducts.rpt & NorthwindProducts.xml files to your website root folder
- Finally, add a new ASPX page and name it PrintCrystalReports.aspx (be sure to UNSELECT the "Place code in separate file" checkbox)

This page allows your user to print the RPT report file to their local printers. It basically converts/exports the RPT report to PDF format and then passes it to the WCPP utility to print it to the specified printer. Please note that the user is required to have Adobe Reader installed to get this code working.

Please paste the following markup and code depending on your preferred language i.e. C# or VB on your PrintCrystalReports.aspx file.

<%@ Page Title="Directly Print Crystal Reports to default client printer without Preview or Print Dialog!" Language="VB" %>

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="Neodynamic.SDK.Web" %>
<%@ Import Namespace="CrystalDecisions.CrystalReports.Engine" %>
<%@ Import Namespace="CrystalDecisions.Shared" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">
Protected Sub Page_Init(sender As Object, e As EventArgs)
'Print report???
If WebClientPrint.ProcessPrintJob(Request) Then

'load and set report's data source
Dim ds As New DataSet()

'create and load rpt in memory
Dim myCrystalReport As New ReportDocument()

'Export rpt to a temp PDF and get binary content
Dim pdfContent As Byte() = Nothing
Using ms As MemoryStream = DirectCast(myCrystalReport.ExportToStream(ExportFormatType.PortableDocFormat), MemoryStream)
pdfContent = ms.ToArray()
End Using

'Now send this file to the client side for printing
'IMPORTANT: Adobe Reader needs to be installed at the client side

Dim useDefaultPrinter As Boolean = (Request("useDefaultPrinter") = "checked")
Dim printerName As String = Server.UrlDecode(Request("printerName"))

'create a temp file name for our PDF report...
Dim fileName As String = Guid.NewGuid().ToString("N") + ".pdf"

'Create a PrintFile object with the pdf report
Dim file As New PrintFile(pdfContent, fileName)
'Create a ClientPrintJob and send it back to the client!
Dim cpj As New ClientPrintJob()
'set file to print...
cpj.PrintFile = file
'set client printer...
If useDefaultPrinter OrElse printerName = "null" Then
cpj.ClientPrinter = New DefaultPrinter()
cpj.ClientPrinter = New InstalledPrinter(printerName)
End If
'send it...

End If
End Sub

<html xmlns="">
<head id="Head1" runat="server">

body{font: 13px 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;background:#ddd;color:#333;margin:0;}
h1{background:#333;color:#fff;padding:10px;font: 29px 'Segoe UI Light', 'Tahoma Light', 'Arial Light', 'Helvetica Light', sans-serif;}
.myRow{width:auto;padding:0 20px 0 20px;height:auto;}
.myMenu{float:left;margin:0 20px 0 0;padding:2px;color:#333;}
.cBlue{border-bottom: 5px solid #6B89B7;}
.cSand{border-bottom: 5px solid #CCCC66;}

<%-- Store User's SessionId --%>
<input type="hidden" id="sid" name="sid" value="<%=Session.SessionID%>" />

<form id="form1" runat="server">

<h1>Directly Print Crystal Reports without Preview or Print Dialog!</h1>
<div class="myRow">
<a href="#">
<div class="myMenu cBlue">
<h2>Print Report</h2>
<p>Print the RPT report without preview!</p>

<a href="" target="_blank">
<div class="myMenu cSand">
<h2>About WebClientPrint</h2>
<p>Know more about WebClientPrint for ASP.NET</p>
<div class="myRow" style="clear:both;background-color:#e3e3e3;" id="pnlPrintSettings">
<br />
<h3>Print the Crystal Reports (RPT) sample.</h3>
<label class="checkbox">
<input type="checkbox" id="useDefaultPrinter"> <strong>Use default printer</strong> or...
<div id="loadPrinters">
<br />
WebClientPrint can detect the installed printers in your machine.
<br />
<input type="button" onclick="javascript:jsWebClientPrint.getPrinters();" value="Load installed printers..." />

<br /><br />
<div id="installedPrinters" style="visibility:hidden">
<br />
<label for="installedPrinterName">Select an installed Printer:</label>
<select name="installedPrinterName" id="installedPrinterName"></select>

<br /><br />
<input type="button" style="font-size:18px" onclick="javascript:jsWebClientPrint.print('useDefaultPrinter=' + $('#useDefaultPrinter').attr('checked') + '&printerName=' + $('#installedPrinterName').val());" value="Print Report..." />

<script type="text/javascript">
var wcppGetPrintersDelay_ms = 5000; //5 sec

function wcpGetPrintersOnSuccess(){
<%-- Display client installed printers --%>
if(arguments[0].length > 0){
var p=arguments[0].split("|");
var options = '';
for (var i = 0; i < p.length; i++) {
options += '<option>' + p[i] + '</option>';
alert("No printers are installed in your system.");

function wcpGetPrintersOnFailure() {
<%-- Do something if printers cannot be got from the client --%>
alert("No printers are installed in your system.");


<%-- Add Reference to jQuery at Google CDN --%>
<script src=""></script>

<%-- Register the WebClientPrint script code --%>


- That's it! Run your website and test it. You can print it to the Default client printer or you can get a list of the installed printers available at the client machine and select one for printing the report.

This Demos
Download WebClientPrint for ASP.NET
More Information about Neodynamic WebClientPrint for ASP.NET

NET Components & Controls