printing to server fails, and I dont know why
Hi,
I am not able to print to a network printer from my server. I have tried about everything the I can think of, including the advice given in the "print a report from the server" thread so far, to no avail. I need to be to give my users this funtionality, as some of them are running on older machines and can't afford the resource burden of opening Crystal enterprise and printing from there, while running the various other apps they have to have running. Anyway, back to the issue. Whenever I try to assign the PrinterName property, I get an "Invalid Printer Name" Following is my code snippet and the error message.
ReportDocument oRpt = new ReportDocument();
oRpt.Load(@"C:\GreenSheet\GreenSheet\Reports\Initi alSend.rpt");
oRpt.SetParameterValue("RequestID", CurrentRequestID);
oRpt.PrintOptions.PrinterName = @"\\bhsi\laser1";
oRpt.PrintToPrinter(1, true, 1, 1);
Ive also tried:
oRpt.PrintOptions.PrinterName = "\\\\bhsi\\laser1";
and I've even tried storing the name to a variable and then just dumping the variable into the PrinterName property. Either way I get the following error:
Error in File C:\GreenSheet\GreenSheet\Reports\InitialSend.rpt: 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: CrystalDecisions.CrystalReports.Engine.InvalidArgu mentException: Error in File C:\GreenSheet\GreenSheet\Reports\InitialSend.rpt: Invalid printer specified.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidArgumentException: Error in File C:\GreenSheet\GreenSheet\Reports\InitialSend.rpt:
Invalid printer specified.]
.F(String , EngineExceptionErrorID
) +406
.A(Int16 , Int32 ) +537
CrystalDecisions.CrystalReports.Engine.PrintOption s.$(String , String !, Int16* ", Int16* #, Int16* $, Int16* %) +808
CrystalDecisions.CrystalReports.Engine.PrintOption s.(String ) +249
CrystalDecisions.CrystalReports.Engine.PrintOption s.set_PrinterName(String value) +4
GreenSheet.Request.btnSubmit_Click(Object sender, EventArgs e) in c:\documents and settings\mis4\vswebcache\192.168.168.19\greensheet \request.aspx.cs:1106
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
Thanks for any and all advice by the way. I glean more info from this forum then anywhere else it seems, and I buy WROX books all the time. The best.
|