Skip to Content
0
Former Member
Apr 13, 2010 at 10:22 AM

Not able to print report to printer from client pc [ Asp.net ( C#) ]

493 Views

Currently I am using crystal report 2008 with Asp.net (Code behind: C#). I am displaying report during page load and its working fine but when I try to print report to printer from client pc. Itu2019s prompting an error that u201CInvalid printer specifiedu201D. As per my understanding, in asp.net ReportDocument.PrintToPrinter(1, false,0,0) is server side function and the report name also searching in the server rather than clientu2019s printer. When I print from development environment, it workd fine because it can find the default printer name which is connected with the development PC. After hosting into server, if I try to print from client side then facing this error. For your reference my print buttong command and the output is given below. Could you please advice how to print report to printer from client PC ?

protected void btnPrint_Click1(object sender, EventArgs

{

// report is declared globally as follows //

//******* ReportDocument report = new ReportDocument(); ***************

System.Drawing.Printing.PrinterSettings oPS = new System.Drawing.Printing.PrinterSettings();

report.PrintOptions.PrinterName = oPS.PrinterName;

report.PrintToPrinter(1, false, 0, 0);

}

Error:

Invalid printer specified.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Invalid printer specified.

Best Regards,

Kamrul