ASP.NET - PrintToPrinter(1, false,0,0) is not working in hoster server application

Asked By mani on 16-Jun-12 03:39 AM
hi..i have application with crystall report it work direct print when running in local machin..
but when hosting in web server

PrintToPrinter(1, false,0,0);
its not working..what will be the problem??any help???
Lalit M replied to mani on 16-Jun-12 09:55 PM

Try to following steps.
   1. Add crystal report (.cr) file to your ASP.NET application.
   2. Add a report instance on the page level.

    Dim report As MyReport = New MyReport
   3. Populate reports data on Page_Init

      ' Get data in a DataSet or DataTable

      Dim ds As DataSet = GetData()

      ' Fill report with the data

   4. Print Report
    report.PrintToPrinter(1, False, 0, 0)
Following code sets page margins and printer name:

Dim margins As PageMargins =  Report.PrintOptions.PageMargins

   margins.bottomMargin = 200

   margins.leftMargin = 200

   margins.rightMargin = 50

   margins.topMargin = 100

   ' Select the printer name

   Report.PrintOptions.PrinterName = printerName

Also check installed the Crystal Reports software on the server, and the app_data for Crystal Reports in the directory of your website?

EDIT: Please try installing CRRedist2005_X64.msi found in C:\Program Files\Microsoft Visual Studio 8\Crystal Reports\CRRedist\X64.
Jitendra Faye replied to mani on 18-Jun-12 07:31 AM

I believe you are not the only one who has problems when trying to deploy Crystal Report for VS 2010. Based on the error message you had, have you checked:

1. Please make sure you just have one CR version installed on your system. If you do have other CR version installed, consider to uninstall it so that your application is not "confused" about the CR version.

2. You need to make sure you download the correct CR version. Since you are using VS 2010, you need to refer to http:// (for 64 bit machine) or http:// (for 32 bit machine). These two are the redistributable packages. You can download full package from the below link as well via http://

3. Make sure you setup FULL TRUST permission on your root folder

4. The LOCAL SERVICE permission must be setup on your application pool

5. Make sure the aspnet_client folder exists on your root folder.

If you can make sure all the 5 points above, your Crystal Report should work without any fuss.

Another important thing to not down here is that if you host your Crystal Report with a shared host, you need to check it with them of whether they really support Crystal Report. If you still have problems, you can switch to, who provides Crystal Report support.